changeset 14:bbcb6fadb60f V0

bug fixes during the port of c-ray
author Merten Sach <msach@mailbox.tu-berlin.de>
date Mon, 15 Aug 2011 16:44:09 +0200
parents 097616da8579
children bb2500771be8
files .hgignore VPThread.h VPThread_PluginFns.c VPThread_Request_Handlers.c VPThread_lib.c
diffstat 5 files changed, 22 insertions(+), 11 deletions(-) [+]
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/.hgignore	Mon Aug 15 16:44:09 2011 +0200
     1.3 @@ -0,0 +1,3 @@
     1.4 +syntax: glob
     1.5 +
     1.6 +*.o
     2.1 --- a/VPThread.h	Tue Jul 26 16:38:23 2011 +0200
     2.2 +++ b/VPThread.h	Mon Aug 15 16:44:09 2011 +0200
     2.3 @@ -166,7 +166,7 @@
     2.4  VPThread__create_thread( VirtProcrFnPtr fnPtr, void *initData,
     2.5                            VirtProcr *creatingPr );
     2.6  
     2.7 -inline VirtProcr *
     2.8 +inline void
     2.9  VPThread__create_thread_with_affinity( VirtProcrFnPtr fnPtr, void *initData,
    2.10                            VirtProcr *creatingPr,  int32  coreToScheduleOnto );
    2.11  
    2.12 @@ -198,7 +198,7 @@
    2.13  inline void
    2.14  VPThread__cond_wait( int32 condIdx, VirtProcr *waitingPr);
    2.15  
    2.16 -inline void *
    2.17 +inline void
    2.18  VPThread__cond_signal( int32 condIdx, VirtProcr *signallingPr );
    2.19  
    2.20  
    2.21 @@ -244,6 +244,9 @@
    2.22  VPThread__malloc( size_t sizeToMalloc, VirtProcr *animPr );
    2.23  
    2.24  void
    2.25 +VPThread__free( void *ptrToFree, VirtProcr *animPr );
    2.26 +
    2.27 +void
    2.28  VPThread__init();
    2.29  
    2.30  void
     3.1 --- a/VPThread_PluginFns.c	Tue Jul 26 16:38:23 2011 +0200
     3.2 +++ b/VPThread_PluginFns.c	Mon Aug 15 16:44:09 2011 +0200
     3.3 @@ -99,6 +99,8 @@
     3.4     if( semReq == NULL ) return;
     3.5     switch( semReq->reqType )
     3.6      {
     3.7 +      case make_procr:
     3.8 +          break;
     3.9        case make_mutex:     handleMakeMutex(  semReq, semEnv);
    3.10           break;
    3.11        case mutex_lock:     handleMutexLock(  semReq, semEnv);
     4.1 --- a/VPThread_Request_Handlers.c	Tue Jul 26 16:38:23 2011 +0200
     4.2 +++ b/VPThread_Request_Handlers.c	Mon Aug 15 16:44:09 2011 +0200
     4.3 @@ -6,6 +6,7 @@
     4.4  
     4.5  #include <stdio.h>
     4.6  #include <stdlib.h>
     4.7 +#include <stdio.h>
     4.8  #include <malloc.h>
     4.9  
    4.10  #include "VMS/VMS.h"
    4.11 @@ -52,7 +53,7 @@
    4.12           Meas_startMutexLock
    4.13        //lookup mutex struc, using mutexIdx as index
    4.14     mutex = semEnv->mutexDynArray[ semReq->mutexIdx ];
    4.15 -
    4.16 +         
    4.17        //see if mutex is free or not
    4.18     if( mutex->holderOfLock == NULL ) //none holding, give lock to requester
    4.19      {
    4.20 @@ -135,12 +136,12 @@
    4.21  handleCondWait( VPThdSemReq *semReq, VPThdSemEnv *semEnv)
    4.22   { VPThdCond   *cond;
    4.23     VPThdMutex  *mutex;
    4.24 -
    4.25 +   
    4.26           Meas_startCondWait
    4.27        //get cond struc out of array of them that's in the sem env
    4.28     cond = semEnv->condDynArray[ semReq->condIdx ];
    4.29  
    4.30 -      //add requester to queue of wait-ers
    4.31 +   //add requester to queue of wait-ers
    4.32     writePrivQ( semReq->requestingPr, cond->waitingQueue );
    4.33      
    4.34        //unlock mutex -- can't reuse above handler 'cause not queuing releaser
    4.35 @@ -170,12 +171,14 @@
    4.36     
    4.37        //take next waiting procr out of queue
    4.38     waitingPr = readPrivQ( cond->waitingQueue );
    4.39 -
    4.40 +   
    4.41        //transfer waiting procr to wait queue of mutex
    4.42        // mutex is guaranteed to be held by signalling procr, so no check
    4.43 -   mutex = cond->partnerMutex;
    4.44 -   pushPrivQ( waitingPr, mutex->waitingQueue ); //is first out when read
    4.45 -
    4.46 +   if(waitingPr){
    4.47 +       mutex = cond->partnerMutex;
    4.48 +       pushPrivQ( waitingPr, mutex->waitingQueue ); //is first out when read
    4.49 +   }
    4.50 +   
    4.51        //re-animate the signalling procr
    4.52     resume_procr( semReq->requestingPr, semEnv );
    4.53           Meas_endCondSignal
     5.1 --- a/VPThread_lib.c	Tue Jul 26 16:38:23 2011 +0200
     5.2 +++ b/VPThread_lib.c	Mon Aug 15 16:44:09 2011 +0200
     5.3 @@ -304,7 +304,7 @@
     5.4     return creatingPr->dataRetFromReq;
     5.5   }
     5.6  
     5.7 -inline VirtProcr *
     5.8 +inline void
     5.9  VPThread__create_thread_with_affinity( VirtProcrFnPtr fnPtr, void *initData,
    5.10                             VirtProcr *creatingPr,  int32  coreToScheduleOnto )
    5.11   { VPThdSemReq  reqData;
    5.12 @@ -436,7 +436,7 @@
    5.13     VMS__send_sem_request( &reqData, waitingPr );
    5.14   }
    5.15  
    5.16 -inline void *
    5.17 +inline void
    5.18  VPThread__cond_signal( int32 condIdx, VirtProcr *signallingPr )
    5.19   { VPThdSemReq  reqData;
    5.20