major rework of jvmti. now we have three processes in jvmti mode. there are still...
[cacao.git] / src / threads / native / threads.h
index 31ab091b7de297746a16aebeb1bfedad127a799a..4f1afcbb7f93944092ad7168af9d66abc0dfe26a 100644 (file)
@@ -1,9 +1,9 @@
 /* src/threads/native/threads.h - native threads header
 
-   Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
-   R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
-   C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
-   Institut f. Computersprachen - TU Wien
+   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+   C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
+   E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
+   J. Wenninger, Institut f. Computersprachen - TU Wien
 
    This file is part of CACAO.
 
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
 
-   Contact: cacao@complang.tuwien.ac.at
+   Contact: cacao@cacaojvm.org
 
    Authors: Stefan Ring
 
    Changes: Christian Thalinger
 
-   $Id: threads.h 3553 2005-11-03 20:43:49Z twisti $
+   $Id: threads.h 4661 2006-03-21 00:04:59Z motse $
 
 */
 
 #ifndef _THREADS_H
 #define _THREADS_H
 
+#include "config.h"
+
 #include <pthread.h>
 #include <semaphore.h>
 #include <ucontext.h>
 
-#include "config.h"
 #include "vm/types.h"
 
 #include "config.h"
@@ -52,7 +53,6 @@
 #include "native/include/java_lang_Thread.h"
 #include "native/include/java_lang_VMThread.h"
 #include "vm/global.h"
-#include "vm/tables.h"
 
 #if defined(__DARWIN__)
 #include <mach/mach.h>
@@ -65,7 +65,7 @@
 #if defined(HAVE___THREAD)
 
 #define THREADSPECIFIC    __thread
-#define THREADOBJECT      ((java_lang_VMThread*) threadobj)
+#define THREADOBJECT      threadobj
 #define THREADINFO        (&threadobj->info)
 
 extern __thread threadobject *threadobj;
@@ -73,8 +73,8 @@ extern __thread threadobject *threadobj;
 #else /* defined(HAVE___THREAD) */
 
 #define THREADSPECIFIC
-#define THREADOBJECT ((java_lang_VMThread*) pthread_getspecific(tkey_threadinfo))
-#define THREADINFO (&((threadobject*) pthread_getspecific(tkey_threadinfo))->info)
+#define THREADOBJECT      pthread_getspecific(tkey_threadinfo)
+#define THREADINFO        (&((threadobject*) pthread_getspecific(tkey_threadinfo))->info)
 
 extern pthread_key_t tkey_threadinfo;
 
@@ -125,7 +125,8 @@ struct nativethread {
 
 /* threadobject ****************************************************************
 
-   Every java.lang.VMThread object is actually an instance of this structure.
+   Every java.lang.VMThread object is actually an instance of this
+   structure.
 
 *******************************************************************************/
 
@@ -159,7 +160,7 @@ struct monitorLockRecord {
        s4                 queuers;
        monitorLockRecord *waiter;
        monitorLockRecord *incharge;
-       bool               waiting;
+       java_objectheader *waiting;
        sem_t              queueSem;
        pthread_mutex_t    resolveLock;
        pthread_cond_t     resolveWait;
@@ -181,9 +182,10 @@ monitorLockRecord *monitorEnter(threadobject *, java_objectheader *);
 bool monitorExit(threadobject *, java_objectheader *);
 
 bool threadHoldsLock(threadobject *t, java_objectheader *o);
-void signal_cond_for_object(java_objectheader *obj);
-void broadcast_cond_for_object(java_objectheader *obj);
-void wait_cond_for_object(java_objectheader *obj, s8 time, s4 nanos);
+
+void wait_cond_for_object(java_objectheader *o, s8 millis, s4 nanos);
+void signal_cond_for_object(java_objectheader *o);
+void broadcast_cond_for_object(java_objectheader *o);
 
 void *thread_getself(void);
 
@@ -200,7 +202,7 @@ void threads_start_thread(thread *t, functionptr function);
 
 void joinAllThreads();
 
-void sleepThread(s8 millis, s4 nanos);
+void thread_sleep(s8 millis, s4 nanos);
 void yieldThread();
 
 void setPriorityThread(thread *t, s4 priority);
@@ -209,6 +211,11 @@ void interruptThread(java_lang_VMThread *);
 bool interruptedThread();
 bool isInterruptedThread(java_lang_VMThread *);
 
+#if defined(ENABLE_JVMTI)
+void setthreadobject(threadobject *thread);
+#endif
+
+
 /* This must not be changed, it is used in asm_criticalsections */
 typedef struct {
        u1 *mcodebegin;
@@ -222,6 +229,9 @@ u1 *thread_checkcritical(u1*);
 extern volatile int stopworldwhere;
 extern threadobject *mainthreadobj;
 
+extern pthread_mutex_t pool_lock;
+extern lockRecordPool *global_pool;
+
 
 void cast_stopworld();
 void cast_startworld();