/[svn]/linuxsampler/trunk/src/common/Condition.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/common/Condition.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1559 by senoner, Wed Nov 14 23:42:15 2007 UTC revision 1560 by schoenebeck, Thu Dec 6 17:19:16 2007 UTC
# Line 28  Line 28 
28    
29  #if defined(WIN32)  #if defined(WIN32)
30  #include <windows.h>  #include <windows.h>
 typedef HANDLE win32thread_mutex_t;  
   
 typedef struct  
 {  
     int waiters_count_;  
     // Number of waiting threads.  
   
     CRITICAL_SECTION waiters_count_lock_;  
     // Serialize access to <waiters_count_>.  
   
     HANDLE sema_;  
     // Semaphore used to queue up threads waiting for the condition to  
     // become signaled.  
   
     HANDLE waiters_done_;  
     // An auto-reset event used by the broadcast/signal thread to wait  
     // for all the waiting thread(s) to wake up and be released from the  
     // semaphore.  
   
     size_t was_broadcast_;  
     // Keeps track of whether we were broadcasting or signaling.  This  
     // allows us to optimize the code if we're just signaling.  
 } win32thread_cond_t;  
31  #endif  #endif
32    
33  namespace LinuxSampler {  namespace LinuxSampler {
34    
35    #if defined(WIN32)
36    class ConditionInternal;
37    #endif
38    
39  /**  /**
40   * Thread safe boolean condition.   * Thread safe boolean condition.
41   *   *
# Line 138  class Condition : public Mutex { Line 119  class Condition : public Mutex {
119    
120      protected:      protected:
121      #if defined(WIN32)      #if defined(WIN32)
122          win32thread_cond_t __win32_true_condition;          friend class ConditionInternal;
123          win32thread_cond_t __win32_false_condition;          struct win32thread_cond_t {
124                int waiters_count_; ///< Number of waiting threads.
125                CRITICAL_SECTION waiters_count_lock_; ///< Serialize access to <waiters_count_>.
126                HANDLE sema_; ///< Semaphore used to queue up threads waiting for the condition to become signaled.
127                HANDLE waiters_done_; ///< An auto-reset event used by the broadcast/signal thread to wait for all the waiting thread(s) to wake up and be released from the semaphore.
128                size_t was_broadcast_; ///< Keeps track of whether we were broadcasting or signaling. This allows us to optimize the code if we're just signaling.
129            } __win32_true_condition, __win32_false_condition;
130      #else      #else
131          pthread_cond_t __posix_true_condition;          pthread_cond_t __posix_true_condition;
132          pthread_cond_t __posix_false_condition;          pthread_cond_t __posix_false_condition;

Legend:
Removed from v.1559  
changed lines
  Added in v.1560

  ViewVC Help
Powered by ViewVC