From ba0f0032bb80af833e5f1a1debe25eb009d16537 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Sun, 3 Apr 2011 05:38:59 +0000 Subject: [PATCH] add wait/notify --- Robust/src/Runtime/object.c | 9 +++++++-- Robust/src/Runtime/object.h | 9 +++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Robust/src/Runtime/object.c b/Robust/src/Runtime/object.c index 14d12050..cdf75048 100644 --- a/Robust/src/Runtime/object.c +++ b/Robust/src/Runtime/object.c @@ -69,20 +69,24 @@ int CALL01(___Object______MonitorEnter____, struct ___Object___ * ___this___) { } #endif } +#ifdef D___Object______notify____ void CALL01(___Object______notify____, struct ___Object___ * ___this___) { pthread_mutex_lock(&objlock); pthread_cond_broadcast(&objcond); pthread_mutex_unlock(&objlock); } - +#endif +#ifdef D___Object______notifyAll____ void CALL01(___Object______notifyAll____, struct ___Object___ * ___this___) { pthread_mutex_lock(&objlock); pthread_cond_broadcast(&objcond); pthread_mutex_unlock(&objlock); } - +#endif +#ifdef D___Object______wait____ void CALL01(___Object______wait____, struct ___Object___ * ___this___) { //release lock + pthread_t self=pthread_self(); int lockcount=VAR(___this___)->lockcount; if (VAR(___this___)->___prevlockobject___==NULL) { pthread_setspecific(threadlocks, VAR(___this___)->___nextlockobject___); @@ -127,6 +131,7 @@ void CALL01(___Object______wait____, struct ___Object___ * ___this___) { } } } +#endif int CALL01(___Object______MonitorExit____, struct ___Object___ * ___this___) { #ifndef NOLOCK diff --git a/Robust/src/Runtime/object.h b/Robust/src/Runtime/object.h index 8c177340..1c430450 100644 --- a/Robust/src/Runtime/object.h +++ b/Robust/src/Runtime/object.h @@ -13,5 +13,14 @@ int CALL01(___Object______getType____, struct ___Object___ * ___this___); #ifdef THREADS int CALL01(___Object______MonitorEnter____, struct ___Object___ * ___this___); int CALL01(___Object______MonitorExit____, struct ___Object___ * ___this___); +#ifdef D___Object______notify____ +void CALL01(___Object______notify____, struct ___Object___ * ___this___); +#endif +#ifdef D___Object______notifyAll____ +void CALL01(___Object______notifyAll____, struct ___Object___ * ___this___); +#endif +#ifdef D___Object______wait____ +void CALL01(___Object______wait____, struct ___Object___ * ___this___); +#endif #endif #endif -- 2.34.1