1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 
  14 
  15 
  16 
  17 
  18 
  19 #ifndef _WINDOWS_TIMEDRWLOCK_H
  20 #define _WINDOWS_TIMEDRWLOCK_H
  21 
  22 #define WIN32_LEAN_AND_MEAN  
  23 #include <windows.h>
  24 
  25 #include <time.h>
  26 
  27 #include "windows-initguard.h"
  28 
  29 #ifndef _glwthread_linked_waitqueue_link_defined
  30 #define _glwthread_linked_waitqueue_link_defined
  31 struct glwthread_waitqueue_link
  32 {
  33   struct glwthread_waitqueue_link *wql_next;
  34   struct glwthread_waitqueue_link *wql_prev;
  35 };
  36 #endif 
  37 typedef struct
  38         {
  39           struct glwthread_waitqueue_link wq_list; 
  40           unsigned int count; 
  41         }
  42         glwthread_clinked_waitqueue_t;
  43 
  44 typedef struct
  45         {
  46           glwthread_initguard_t guard; 
  47           CRITICAL_SECTION lock; 
  48           glwthread_clinked_waitqueue_t waiting_readers; 
  49           glwthread_clinked_waitqueue_t waiting_writers; 
  50           int runcount; 
  51         }
  52         glwthread_timedrwlock_t;
  53 
  54 #define GLWTHREAD_TIMEDRWLOCK_INIT { GLWTHREAD_INITGUARD_INIT }
  55 
  56 #ifdef __cplusplus
  57 extern "C" {
  58 #endif
  59 
  60 extern void glwthread_timedrwlock_init (glwthread_timedrwlock_t *lock);
  61 extern int glwthread_timedrwlock_rdlock (glwthread_timedrwlock_t *lock);
  62 extern int glwthread_timedrwlock_wrlock (glwthread_timedrwlock_t *lock);
  63 extern int glwthread_timedrwlock_tryrdlock (glwthread_timedrwlock_t *lock);
  64 extern int glwthread_timedrwlock_trywrlock (glwthread_timedrwlock_t *lock);
  65 extern int glwthread_timedrwlock_timedrdlock (glwthread_timedrwlock_t *lock,
  66                                               const struct timespec *abstime);
  67 extern int glwthread_timedrwlock_timedwrlock (glwthread_timedrwlock_t *lock,
  68                                               const struct timespec *abstime);
  69 extern int glwthread_timedrwlock_unlock (glwthread_timedrwlock_t *lock);
  70 extern int glwthread_timedrwlock_destroy (glwthread_timedrwlock_t *lock);
  71 
  72 #ifdef __cplusplus
  73 }
  74 #endif
  75 
  76 #endif