1 /* src/threads/lock-common.h - common stuff of lock implementation
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
8 This file is part of CACAO.
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.
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.
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
28 #ifndef _LOCK_COMMON_H
29 #define _LOCK_COMMON_H
34 #include "vm/global.h"
36 /* ATTENTION: Don't include a threads header here, as it could include
37 java_lang_Thread.h and thus break the build (means, it recompiles
38 every time)! Take care of that... */
40 #if defined(ENABLE_THREADS)
41 # include "threads/native/lock.h"
43 # include "threads/none/lock.h"
47 /* only define the following stuff with thread enabled ************************/
49 #if defined(ENABLE_THREADS)
51 /* functions ******************************************************************/
55 void lock_init_object_lock(java_object_t *);
56 lock_record_t *lock_get_initial_lock_word(void);
58 ptrint lock_pre_compute_thinlock(s4 index);
60 bool lock_monitor_enter(java_object_t *);
61 bool lock_monitor_exit(java_object_t *);
63 #define LOCK_monitor_enter (functionptr) lock_monitor_enter
64 #define LOCK_monitor_exit (functionptr) lock_monitor_exit
66 bool lock_is_held_by_current_thread(java_object_t *o);
68 void lock_wait_for_object(java_object_t *o, s8 millis, s4 nanos);
69 void lock_notify_object(java_object_t *o);
70 void lock_notify_all_object(java_object_t *o);
72 #endif /* ENABLE_THREADS */
74 #endif /* _LOCK_COMMON_H */
78 * These are local overrides for various environment variables in Emacs.
79 * Please do not remove this and leave it at the end of the file, where
80 * Emacs will automagically detect them.
81 * ---------------------------------------------------------------------
88 * vim:noexpandtab:sw=4:ts=4: