2009-12-01 Jb Evain <jbevain@novell.com>
[mono.git] / mono / metadata / lock-tracer.h
blob40beac748e8c30c76f4182a53dd7c5c2e826847e
1 #ifndef __MONO_METADATA_LOCK_TRACER_H__
2 #define __MONO_METADATA_LOCK_TRACER_H__
4 /*This is a private header*/
5 #include <glib.h>
7 #include "mono/utils/mono-compiler.h"
9 G_BEGIN_DECLS
11 typedef enum {
12 InvalidLock = 0,
13 LoaderLock,
14 ImageDataLock,
15 DomainLock,
16 DomainAssembliesLock,
17 DomainJitCodeHashLock,
18 } RuntimeLocks;
20 #ifdef LOCK_TRACER
22 void mono_locks_tracer_init (void) MONO_INTERNAL;
24 void mono_locks_lock_acquired (RuntimeLocks kind, gpointer lock) MONO_INTERNAL;
25 void mono_locks_lock_released (RuntimeLocks kind, gpointer lock) MONO_INTERNAL;
27 #else
29 #define mono_locks_tracer_init() do {} while (0)
31 #define mono_locks_lock_acquired(__UNUSED0, __UNUSED1) do {} while (0)
32 #define mono_locks_lock_released(__UNUSED0, __UNUSED1) do {} while (0)
34 #endif
36 #define mono_locks_acquire(LOCK, NAME) do { \
37 EnterCriticalSection (LOCK); \
38 mono_locks_lock_acquired (NAME, LOCK); \
39 } while (0)
41 #define mono_locks_release(LOCK, NAME) do { \
42 mono_locks_lock_released (NAME, LOCK); \
43 LeaveCriticalSection (LOCK); \
44 } while (0)
46 G_END_DECLS
48 #endif /* __MONO_METADATA_LOCK_TRACER_H__ */