adding a test case
[IRC.git] / Robust / src / Runtime / thread.h
1 #ifndef THREAD_H
2 #define THREAD_H
3 #include "methodheaders.h"
4 #include <pthread.h>
5 #include "objtypes.h"
6
7 extern int threadcount;
8 extern pthread_mutex_t gclock;
9 extern pthread_mutex_t gclistlock;
10 extern pthread_cond_t gccond;
11 extern pthread_mutex_t objlock;
12 extern pthread_cond_t objcond;
13 extern pthread_key_t threadlocks;
14 extern pthread_mutex_t atomiclock;
15 #ifdef MAC
16 extern pthread_key_t litemkey;
17 extern pthread_key_t macthreadid;
18 extern pthread_key_t memorybasekey;
19 extern pthread_key_t memorytopkey;
20 #endif
21
22 #ifdef PRECISE_GC
23 #define ATOMICLOCK if (pthread_mutex_trylock(&atomiclock)!=0) { \
24     stopforgc((struct garbagelist *) &___locals___);            \
25     pthread_mutex_lock(&atomiclock);                            \
26     restartaftergc();                                           \
27 }
28
29 #define ATOMICUNLOCK pthread_mutex_unlock(&atomiclock)
30 #else
31 #define ATOMICLOCK pthread_mutex_lock(&atomiclock)
32 #define ATOMICUNLOCK pthread_mutex_unlock(&atomiclock)
33 #endif
34
35 #if defined(THREADS)||defined(STM)
36 void initthread(ThreadPtr ___this___);
37 #endif
38 #ifdef DSTM
39 void initDSMthread(int *ptr);
40 void startDSMthread(int oid, int objType);
41 extern void * virtualtable[];
42 #endif
43 #endif