2003-02-02 Martin Baulig <martin@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 <mono/io-layer/io-layer.h>
16
17 /*
18  * This is bonkers. We are emulating condition variables here using
19  * win32 calls, which on Linux are being emulated with condition
20  * variables :-)
21  *
22  * See http://www.cs.wustl.edu/~schmidt/win32-cv-1.html for the design.
23  */
24
25 typedef struct 
26 {
27         HANDLE monitor;
28         guint32 tid;
29
30         /* Need to count how many times this monitor object has been
31          * locked by the owning thread, so that we can unlock it
32          * completely in Wait()
33          */
34         guint32 count;
35
36         /* condition variable management */
37         guint32 waiters_count;
38         CRITICAL_SECTION waiters_count_lock;
39         HANDLE sema;
40         HANDLE waiters_done;
41         gboolean was_broadcast;
42 } MonoThreadsSync;
43
44 #endif /* _MONO_METADATA_THREADS_TYPES_H_ */