/[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 1480 by schoenebeck, Mon Sep 3 23:59:10 2007 UTC revision 1481 by senoner, Wed Nov 14 23:42:15 2007 UTC
# Line 26  Line 26 
26    
27  #include "Mutex.h"  #include "Mutex.h"
28    
29    #if defined(WIN32)
30    #include <windows.h>
31    typedef HANDLE win32thread_mutex_t;
32    
33    typedef struct
34    {
35        int waiters_count_;
36        // Number of waiting threads.
37    
38        CRITICAL_SECTION waiters_count_lock_;
39        // Serialize access to <waiters_count_>.
40    
41        HANDLE sema_;
42        // Semaphore used to queue up threads waiting for the condition to
43        // become signaled.
44    
45        HANDLE waiters_done_;
46        // An auto-reset event used by the broadcast/signal thread to wait
47        // for all the waiting thread(s) to wake up and be released from the
48        // semaphore.
49    
50        size_t was_broadcast_;
51        // Keeps track of whether we were broadcasting or signaling.  This
52        // allows us to optimize the code if we're just signaling.
53    } win32thread_cond_t;
54    #endif
55    
56  namespace LinuxSampler {  namespace LinuxSampler {
57    
58  /**  /**
# Line 110  class Condition : public Mutex { Line 137  class Condition : public Mutex {
137          bool GetUnsafe();          bool GetUnsafe();
138    
139      protected:      protected:
140        #if defined(WIN32)
141            win32thread_cond_t __win32_true_condition;
142            win32thread_cond_t __win32_false_condition;
143        #else
144          pthread_cond_t __posix_true_condition;          pthread_cond_t __posix_true_condition;
145          pthread_cond_t __posix_false_condition;          pthread_cond_t __posix_false_condition;
146        #endif
147          bool bCondition;          bool bCondition;
148  };  };
149    

Legend:
Removed from v.1480  
changed lines
  Added in v.1481

  ViewVC Help
Powered by ViewVC