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, 2003

Threading from Managed C++

(Page 6 of 7)
Threading from Managed C++

Listing 5: Only one class function’s lock block can execute at a time

#using <mscorlib.dll>
using namespace System;
using namespace System::Threading;

__gc class Th05
{
public:
   static void M1()
   {
      // ...
      Monitor::Enter(__typeof(Th05));
      try
      {
         // read from a file
      }
      __finally
      {
         Monitor::Exit(__typeof(Th05));
      }
      // ...
   }

   public static void M2()
   {
      // ...
   static void M2()
   {
      // ...
      Monitor::Enter(__typeof(Th05));
      try
      {
         // update a display
      }
      __finally
      {
         Monitor::Exit(__typeof(Th05));
      }
      // ...
   }
};
— End of Listing —
Previous Page | 1 | 2 | 3 | 4 | 5 | 6 | 7 Next Page
RELATED ARTICLES
No Related Articles
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK