Tue May 14 16:59:44 CEST 2002 Paolo Molaro <lupus@ximian.com>
[mono.git] / mono / metadata / threads-types.h
1 /*
2  * threads-types.h: Generic thread typedef support (includes
3  * system-specific files)
4  *
5  * Author:
6  *      Dick Porter (dick@ximian.com)
7  *
8  * (C) 2001 Ximian, Inc
9  */
10
11 #ifndef _MONO_METADATA_THREADS_TYPES_H_
12 #define _MONO_METADATA_THREADS_TYPES_H_
13
14
15 #include <config.h>
16
17 #include <mono/io-layer/io-layer.h>
18
19 /*
20  * This is bonkers. We are emulating condition variables here using
21  * win32 calls, which on Linux are being emulated with condition
22  * variables :-)
23  *
24  * See http://www.cs.wustl.edu/~schmidt/win32-cv-1.html for the design.
25  */
26
27 typedef struct 
28 {
29         HANDLE monitor;
30         guint32 tid;
31
32         /* Need to count how many times this monitor object has been
33          * locked by the owning thread, so that we can unlock it
34          * completely in Wait()
35          */
36         guint32 count;
37
38         /* condition variable management */
39         guint32 waiters_count;
40         CRITICAL_SECTION waiters_count_lock;
41         HANDLE sema;
42         HANDLE waiters_done;
43         gboolean was_broadcast;
44 } MonoThreadsSync;
45
46 #endif /* _MONO_METADATA_THREADS_TYPES_H_ */