/[svn]/liblscp/trunk/lscp/thread.h
ViewVC logotype

Diff of /liblscp/trunk/lscp/thread.h

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

revision 176 by capela, Fri Jun 4 14:32:51 2004 UTC revision 177 by capela, Tue Jul 6 14:06:17 2004 UTC
# Line 77  typedef pthread_mutex_t lscp_mutex_t; Line 77  typedef pthread_mutex_t lscp_mutex_t;
77  #endif  #endif
78    
79  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
80    // Simple condition variables (FIXME: probably incorrect on WIN32).
81    
82    #if defined(WIN32)
83    typedef HANDLE lscp_cond_t;
84    #define lscp_cond_init(c)       { (c) = CreateEvent(NULL, FALSE, FALSE, NULL); }
85    #define lscp_cond_destroy(c)    if (c) { CloseHandle(c); }
86    #define lscp_cond_wait(c, m)    { lscp_mutex_unlock(m); WaitForSingleObject((c), INFINITE); lscp_mutex_lock(m); }
87    #define lscp_cond_signal(c)     SetEvent(c)
88    #else
89    typedef pthread_cond_t lscp_cond_t;
90    #define lscp_cond_init(c)       pthread_cond_init(&(c), NULL)
91    #define lscp_cond_destroy(c)    pthread_cond_destroy(&(c))
92    #define lscp_cond_wait(c, m)    pthread_cond_wait(&(c), &(m))
93    #define lscp_cond_signal(c)     pthread_cond_signal(&(c))
94    #endif
95    
96    //-------------------------------------------------------------------------
97  // Threads.  // Threads.
98    
99  struct _lscp_thread_t;  struct _lscp_thread_t;

Legend:
Removed from v.176  
changed lines
  Added in v.177

  ViewVC Help
Powered by ViewVC