FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
C++
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
October 01, 2005

C++/CLI Threading: Part I

(Page 7 of 7)

October, 2005: C++/CLI Threading: Part I

Listing 4

using namespace System::Threading;

public ref class C
{
/*1*/ static Object^ Lock = gcnew Object;

public:
  static void F1()
  {
/*2*/   Monitor::Enter(C::typeid);
/*3*/   try {
      // perform some operation(s)
    }
    finally {
      Monitor::Exit(C::typeid);
    }
  }

  static void F2()
  {
    Monitor::Enter(C::typeid);
    // ...
    Monitor::Exit(C::typeid);
  }

  static void F3()
  {
/*4*/   Monitor::Enter(Lock);
    // ...
    Monitor::Exit(Lock);
  }

  static void F4()
  {
    Monitor::Enter(Lock);
    // ...
    Monitor::Exit(Lock);
  }
};

Previous Page | 1 | 2 | 3 | 4 | 5 | 6 | 7
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK