* src/threads/threads-common.c (threads_start_javathread): Changed
[cacao.git] / src / threads / lock-common.h
1 /* src/threads/lock-common.h - common stuff of lock implementation
2
3    Copyright (C) 2007 R. Grafl, A. Krall, C. Kruegel,
4    C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5    E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6    J. Wenninger, Institut f. Computersprachen - TU Wien
7
8    This file is part of CACAO.
9
10    This program is free software; you can redistribute it and/or
11    modify it under the terms of the GNU General Public License as
12    published by the Free Software Foundation; either version 2, or (at
13    your option) any later version.
14
15    This program is distributed in the hope that it will be useful, but
16    WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18    General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23    02110-1301, USA.
24
25    $Id: threads.h 4866 2006-05-01 21:40:38Z edwin $
26
27 */
28
29
30 #ifndef _LOCK_COMMON_H
31 #define _LOCK_COMMON_H
32
33 #include "config.h"
34 #include "vm/types.h"
35
36 #include "vm/global.h"
37
38 #if defined(ENABLE_THREADS)
39 # include "threads/native/lock.h"
40 #else
41 # include "threads/none/lock.h"
42 #endif
43
44 #include "threads/threads-common.h"
45
46
47 /* only define the following stuff with thread enabled ************************/
48
49 #if defined(ENABLE_THREADS)
50
51 /* functions ******************************************************************/
52
53 void lock_init(void);
54
55 void lock_init_execution_env(struct threadobject *thread);
56 void lock_record_free_pools(lock_record_pool_t *pool);
57
58 void lock_init_object_lock(java_objectheader *);
59 lock_record_t *lock_get_initial_lock_word(void);
60
61 ptrint lock_pre_compute_thinlock(s4 index);
62
63 bool lock_monitor_enter(java_objectheader *);
64 bool lock_monitor_exit(java_objectheader *);
65
66 #define LOCK_monitor_enter    (functionptr) lock_monitor_enter
67 #define LOCK_monitor_exit     (functionptr) lock_monitor_exit
68
69 bool lock_is_held_by_current_thread(java_objectheader *o);
70
71 void lock_wait_for_object(java_objectheader *o, s8 millis, s4 nanos);
72 void lock_notify_object(java_objectheader *o);
73 void lock_notify_all_object(java_objectheader *o);
74
75 #endif /* ENABLE_THREADS */
76
77 #endif /* _LOCK_COMMON_H */
78
79
80 /*
81  * These are local overrides for various environment variables in Emacs.
82  * Please do not remove this and leave it at the end of the file, where
83  * Emacs will automagically detect them.
84  * ---------------------------------------------------------------------
85  * Local variables:
86  * mode: c
87  * indent-tabs-mode: t
88  * c-basic-offset: 4
89  * tab-width: 4
90  * End:
91  * vim:noexpandtab:sw=4:ts=4:
92  */