| 
            Last change
 on this file since 1228 was             1016, checked in by ansari, 25 years ago           | 
        
        
          | 
             
Creation du module JThreadsC++, importation du code des classes 
de Thread a la Java de Object Oriented Concepts Inc - Reza 19/5/2000 
 
           | 
        
        
          | 
            File size:
            1.5 KB
           | 
        
      
      
| Rev | Line |   | 
|---|
| [1016] | 1 | // **********************************************************************
 | 
|---|
 | 2 | //
 | 
|---|
 | 3 | // Copyright (c) 2000
 | 
|---|
 | 4 | // Object Oriented Concepts, Inc.
 | 
|---|
 | 5 | // Billerica, MA, USA
 | 
|---|
 | 6 | //
 | 
|---|
 | 7 | // All Rights Reserved
 | 
|---|
 | 8 | //
 | 
|---|
 | 9 | // **********************************************************************
 | 
|---|
 | 10 | 
 | 
|---|
 | 11 | #ifndef JTC_EVENT_H
 | 
|---|
 | 12 | #define JTC_EVENT_H
 | 
|---|
 | 13 | 
 | 
|---|
 | 14 | //
 | 
|---|
 | 15 | // This is an internal class to JTC. Do not directly use. This class
 | 
|---|
 | 16 | // acts like an event object under WIN32. This is a synchronization
 | 
|---|
 | 17 | // object that allows one thread to notify another that an event has
 | 
|---|
 | 18 | // occurred.
 | 
|---|
 | 19 | //
 | 
|---|
 | 20 | class JTCEvent
 | 
|---|
 | 21 | {
 | 
|---|
 | 22 |     //
 | 
|---|
 | 23 |     // Hide copy constructor and assignment operator.
 | 
|---|
 | 24 |     //
 | 
|---|
 | 25 |     JTCEvent(const JTCEvent&);
 | 
|---|
 | 26 |     void operator=(const JTCEvent&);
 | 
|---|
 | 27 | 
 | 
|---|
 | 28 | #if defined(HAVE_POSIX_THREADS) || defined(HAVE_DCE_THREADS)
 | 
|---|
 | 29 |     pthread_cond_t cond_; // Associated condition variable.
 | 
|---|
 | 30 |     JTCMutex mut_; // Condition variables mutex.
 | 
|---|
 | 31 |     bool posted_; // State flag for signalled/unsignalled.
 | 
|---|
 | 32 | #endif
 | 
|---|
 | 33 | 
 | 
|---|
 | 34 | #if defined(HAVE_WIN32_THREADS)
 | 
|---|
 | 35 |     HANDLE event_; // Handle to event object.
 | 
|---|
 | 36 | #endif
 | 
|---|
 | 37 | 
 | 
|---|
 | 38 | public:
 | 
|---|
 | 39 | 
 | 
|---|
 | 40 |     JTCEvent();
 | 
|---|
 | 41 |     ~JTCEvent();
 | 
|---|
 | 42 | 
 | 
|---|
 | 43 |     //
 | 
|---|
 | 44 |     // Set the event to `signaled'.
 | 
|---|
 | 45 |     //
 | 
|---|
 | 46 |     void post();
 | 
|---|
 | 47 | 
 | 
|---|
 | 48 |     //
 | 
|---|
 | 49 |     // Set the state to `signaled', Release any waiting threads,
 | 
|---|
 | 50 |     //
 | 
|---|
 | 51 |     void pulse();
 | 
|---|
 | 52 | 
 | 
|---|
 | 53 |     //
 | 
|---|
 | 54 |     // Suspend the calling thread until the event is `signaled'.
 | 
|---|
 | 55 |     //
 | 
|---|
 | 56 |     void wait();
 | 
|---|
 | 57 | 
 | 
|---|
 | 58 |     //
 | 
|---|
 | 59 |     // Set the state to `unsignaled'.
 | 
|---|
 | 60 |     //
 | 
|---|
 | 61 |     void reset();
 | 
|---|
 | 62 | 
 | 
|---|
 | 63 |     //
 | 
|---|
 | 64 |     // Return true if the event is `signaled', false otherwise.
 | 
|---|
 | 65 |     //
 | 
|---|
 | 66 |     bool posted();
 | 
|---|
 | 67 | };
 | 
|---|
 | 68 | 
 | 
|---|
 | 69 | #endif
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.