2010-03-25 Mark Probst <mark.probst@gmail.com>
[mono.git] / mono / metadata / sgen-gc.h
1 /*
2  * Copyright 2001-2003 Ximian, Inc
3  * Copyright 2003-2010 Novell, Inc.
4  * 
5  * Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sublicense, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  * 
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  * 
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 #ifndef __MONO_SGENGC_H__
25 #define __MONO_SGENGC_H__
26
27 /* pthread impl */
28 #include <pthread.h>
29
30 #define ARCH_THREAD_TYPE pthread_t
31 #define ARCH_GET_THREAD pthread_self
32 #define ARCH_THREAD_EQUALS(a,b) pthread_equal (a, b)
33
34 /*
35  * Recursion is not allowed for the thread lock.
36  */
37 #define LOCK_DECLARE(name) pthread_mutex_t name = PTHREAD_MUTEX_INITIALIZER
38 #define LOCK_INIT(name)
39 #define LOCK_GC pthread_mutex_lock (&gc_mutex)
40 #define UNLOCK_GC pthread_mutex_unlock (&gc_mutex)
41 #define LOCK_INTERRUPTION pthread_mutex_lock (&interruption_mutex)
42 #define UNLOCK_INTERRUPTION pthread_mutex_unlock (&interruption_mutex)
43
44 /* non-pthread will need to provide their own version of start/stop */
45 #define USE_SIGNAL_BASED_START_STOP_WORLD 1
46 /* we intercept pthread_create calls to know which threads exist */
47 #define USE_PTHREAD_INTERCEPT 1
48
49 #endif /* __MONO_SGENGC_H__ */
50