#ifndef MAC
__thread struct lockvector lvector;
+__thread int mythreadid;
#endif
#ifdef D___Object______nativehashCode____
void CALL01(___Object______MonitorEnter____, struct ___Object___ * ___this___) {
#ifdef MAC
struct lockvector *lptr=(struct lockvector *)pthread_getspecific(threadlocks);
+ int self=pthread_getspecific(macthreadid);
#else
struct lockvector *lptr=&lvector;
+ int self=mythreadid;
#endif
struct lockpair *lpair=&lptr->locks[lptr->index++];
- pthread_t self=pthread_self();
lpair->object=VAR(___this___);
if (self==VAR(___this___)->tid) {
#ifdef D___Object______wait____
void CALL01(___Object______wait____, struct ___Object___ * ___this___) {
+#ifdef MAC
+ int self=pthread_getspecific(macthreadid);
+#else
+ int self=mythreadid;
+#endif
pthread_t self=pthread_self();
int notifycount=VAR(___this___)->notifycount;
BARRIER();
pthread_mutex_t joinlock;
pthread_cond_t joincond;
pthread_key_t threadlocks;
+pthread_key_t macthreadid;
pthread_mutex_t threadnotifylock;
pthread_cond_t threadnotifycond;
pthread_key_t oidval;
pthread_mutex_init(&joinlock,NULL);
pthread_cond_init(&joincond,NULL);
#ifdef MAC
+ pthread_key_create(&macthreadid, NULL);
pthread_key_create(&threadlocks, NULL);
pthread_key_create(&litem, NULL);
#endif
litem->lockvector=lvector;
lvector->index=0;
pthread_setspecific(threadlocks, lvector);
+ pthread_setspecific(macthreadid, 0);
pthread_setspecific(litemkey, litem);
litem->prev=NULL;
litem->next=list;
list=litem;
#else
//Add our litem to list of threads
+ mythreadid=0;
litem.prev=NULL;
litem.next=list;
litem.lvector=&lvector;
}
#if defined(THREADS)||defined(STM)
+int threadcounter=0;
+
void initthread(struct ___Thread___ * ___this___) {
#ifdef AFFINITY
set_affinity();
lvector.index=0;
litem.prev=NULL;
pthread_mutex_lock(&gclistlock);
+#ifdef MAC
+ pthread_setspecific(macthreadid, ++threadcounter);
+#else
+ mythreadid=++threadcounter;
+#endif
litem.next=list;
if(list!=NULL)
list->prev=&litem;