Fix mysterious unremovable file part 2 ?
[cacao.git] / src / threads / lock-common.h
1 /* src/threads/lock-common.h - common stuff of lock implementation
2
3    Copyright (C) 2007, 2008
4    CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
5
6    This file is part of CACAO.
7
8    This program is free software; you can redistribute it and/or
9    modify it under the terms of the GNU General Public License as
10    published by the Free Software Foundation; either version 2, or (at
11    your option) any later version.
12
13    This program is distributed in the hope that it will be useful, but
14    WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16    General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21    02110-1301, USA.
22
23 */
24
25
26 #ifndef _LOCK_COMMON_H
27 #define _LOCK_COMMON_H
28
29 #include "config.h"
30 #include "vm/types.h"
31
32 #include "vm/global.h"
33
34 #if defined(ENABLE_THREADS)
35 # include "threads/posix/lock.h"
36 #else
37 # include "threads/none/lock.h"
38 #endif
39
40
41 /* only define the following stuff with thread enabled ************************/
42
43 #if defined(ENABLE_THREADS)
44
45 /* functions ******************************************************************/
46
47 void lock_init(void);
48
49 void lock_init_object_lock(java_object_t *);
50
51 ptrint lock_pre_compute_thinlock(s4 index);
52
53 bool lock_monitor_enter(java_handle_t *);
54 bool lock_monitor_exit(java_handle_t *);
55
56 #define LOCK_monitor_enter    (functionptr) lock_monitor_enter
57 #define LOCK_monitor_exit     (functionptr) lock_monitor_exit
58
59 bool lock_is_held_by_current_thread(java_handle_t *o);
60
61 void lock_wait_for_object(java_handle_t *o, s8 millis, s4 nanos);
62 void lock_notify_object(java_handle_t *o);
63 void lock_notify_all_object(java_handle_t *o);
64
65 #endif /* ENABLE_THREADS */
66
67 #endif /* _LOCK_COMMON_H */
68
69
70 /*
71  * These are local overrides for various environment variables in Emacs.
72  * Please do not remove this and leave it at the end of the file, where
73  * Emacs will automagically detect them.
74  * ---------------------------------------------------------------------
75  * Local variables:
76  * mode: c
77  * indent-tabs-mode: t
78  * c-basic-offset: 4
79  * tab-width: 4
80  * End:
81  * vim:noexpandtab:sw=4:ts=4:
82  */