# HG changeset patch # User Merten Sach # Date 1313419449 -7200 # Node ID bbcb6fadb60f7ee1140accd1bd6165d9958fa78e # Parent 097616da8579c34c9e89601f0151c0f1eb1249cb bug fixes during the port of c-ray diff -r 097616da8579 -r bbcb6fadb60f .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Mon Aug 15 16:44:09 2011 +0200 @@ -0,0 +1,3 @@ +syntax: glob + +*.o diff -r 097616da8579 -r bbcb6fadb60f VPThread.h --- a/VPThread.h Tue Jul 26 16:38:23 2011 +0200 +++ b/VPThread.h Mon Aug 15 16:44:09 2011 +0200 @@ -166,7 +166,7 @@ VPThread__create_thread( VirtProcrFnPtr fnPtr, void *initData, VirtProcr *creatingPr ); -inline VirtProcr * +inline void VPThread__create_thread_with_affinity( VirtProcrFnPtr fnPtr, void *initData, VirtProcr *creatingPr, int32 coreToScheduleOnto ); @@ -198,7 +198,7 @@ inline void VPThread__cond_wait( int32 condIdx, VirtProcr *waitingPr); -inline void * +inline void VPThread__cond_signal( int32 condIdx, VirtProcr *signallingPr ); @@ -244,6 +244,9 @@ VPThread__malloc( size_t sizeToMalloc, VirtProcr *animPr ); void +VPThread__free( void *ptrToFree, VirtProcr *animPr ); + +void VPThread__init(); void diff -r 097616da8579 -r bbcb6fadb60f VPThread_PluginFns.c --- a/VPThread_PluginFns.c Tue Jul 26 16:38:23 2011 +0200 +++ b/VPThread_PluginFns.c Mon Aug 15 16:44:09 2011 +0200 @@ -99,6 +99,8 @@ if( semReq == NULL ) return; switch( semReq->reqType ) { + case make_procr: + break; case make_mutex: handleMakeMutex( semReq, semEnv); break; case mutex_lock: handleMutexLock( semReq, semEnv); diff -r 097616da8579 -r bbcb6fadb60f VPThread_Request_Handlers.c --- a/VPThread_Request_Handlers.c Tue Jul 26 16:38:23 2011 +0200 +++ b/VPThread_Request_Handlers.c Mon Aug 15 16:44:09 2011 +0200 @@ -6,6 +6,7 @@ #include #include +#include #include #include "VMS/VMS.h" @@ -52,7 +53,7 @@ Meas_startMutexLock //lookup mutex struc, using mutexIdx as index mutex = semEnv->mutexDynArray[ semReq->mutexIdx ]; - + //see if mutex is free or not if( mutex->holderOfLock == NULL ) //none holding, give lock to requester { @@ -135,12 +136,12 @@ handleCondWait( VPThdSemReq *semReq, VPThdSemEnv *semEnv) { VPThdCond *cond; VPThdMutex *mutex; - + Meas_startCondWait //get cond struc out of array of them that's in the sem env cond = semEnv->condDynArray[ semReq->condIdx ]; - //add requester to queue of wait-ers + //add requester to queue of wait-ers writePrivQ( semReq->requestingPr, cond->waitingQueue ); //unlock mutex -- can't reuse above handler 'cause not queuing releaser @@ -170,12 +171,14 @@ //take next waiting procr out of queue waitingPr = readPrivQ( cond->waitingQueue ); - + //transfer waiting procr to wait queue of mutex // mutex is guaranteed to be held by signalling procr, so no check - mutex = cond->partnerMutex; - pushPrivQ( waitingPr, mutex->waitingQueue ); //is first out when read - + if(waitingPr){ + mutex = cond->partnerMutex; + pushPrivQ( waitingPr, mutex->waitingQueue ); //is first out when read + } + //re-animate the signalling procr resume_procr( semReq->requestingPr, semEnv ); Meas_endCondSignal diff -r 097616da8579 -r bbcb6fadb60f VPThread_lib.c --- a/VPThread_lib.c Tue Jul 26 16:38:23 2011 +0200 +++ b/VPThread_lib.c Mon Aug 15 16:44:09 2011 +0200 @@ -304,7 +304,7 @@ return creatingPr->dataRetFromReq; } -inline VirtProcr * +inline void VPThread__create_thread_with_affinity( VirtProcrFnPtr fnPtr, void *initData, VirtProcr *creatingPr, int32 coreToScheduleOnto ) { VPThdSemReq reqData; @@ -436,7 +436,7 @@ VMS__send_sem_request( &reqData, waitingPr ); } -inline void * +inline void VPThread__cond_signal( int32 condIdx, VirtProcr *signallingPr ) { VPThdSemReq reqData;