1 /* sync.h: Header file for cygwin synchronization primitives.
3 This file is part of Cygwin.
5 This software is a copyrighted work licensed under the terms of the
6 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
11 /* FIXME: Note that currently this class cannot be allocated via `new' since
12 there are issues with malloc and fork. */
18 LONG sync
; /* Used to serialize access to this class. */
19 LONG waiters
; /* Number of threads waiting for lock. */
20 HANDLE bruteforce
; /* event handle used to control waiting for lock. */
22 LONG visits
; /* Count of number of times a thread has called acquire. */
23 void *tls
; /* Tls of lock owner. */
26 /* The real constructor. */
27 muto
*init (const char *);
29 #if 0 /* FIXME: See comment in sync.cc */
32 int acquire (DWORD ms
= INFINITE
); /* Acquire the lock. */
33 int release (_cygtls
* = &_my_tls
); /* Release the lock. */
36 void upforgrabs () {tls
= this;} // just set to an invalid address
38 operator int () const {return !!name
;}
46 static void init () {locker
.init ("lock_process");}
47 void dont_bother () {skip_unlock
= true;}
48 lock_process (bool exiting
= false)
51 skip_unlock
= exiting
;
63 operator LONG () const {return locker
.visits
; }
64 static void force_release (_cygtls
*tid
) {locker
.release (tid
);}
66 friend class fhandler_fifo
;