diff VPThread.h @ 2:e960a8d18f7c

Added singleton, atomic, transactions -- don't think it's working singletons yet
author Me
date Tue, 16 Nov 2010 16:04:29 +0100
parents 1d3157ac56c4
children 505d3c674ce8
line diff
     1.1 --- a/VPThread.h	Thu Nov 11 04:29:10 2010 -0800
     1.2 +++ b/VPThread.h	Tue Nov 16 16:04:29 2010 +0100
     1.3 @@ -45,7 +45,8 @@
     1.4     make_procr,
     1.5     malloc_req,
     1.6     free_req,
     1.7 -   singleton,
     1.8 +   singleton_start,
     1.9 +   singleton_end,
    1.10     atomic,
    1.11     trans_start,
    1.12     trans_end
    1.13 @@ -82,30 +83,14 @@
    1.14   }
    1.15  VPThdTrans;
    1.16  
    1.17 -
    1.18  typedef struct
    1.19   {
    1.20 -      //Standard stuff will be in most every semantic env
    1.21 -   PrivQueueStruc  **readyVPQs;
    1.22 -   int32             numVirtPr;
    1.23 -   int32             nextCoreToGetNewPr;
    1.24 -   int32             primitiveStartTime;
    1.25 -
    1.26 -      //Specific to this semantic layer
    1.27 -   VPThdMutex      **mutexDynArray;
    1.28 -   PrivDynArrayInfo *mutexDynArrayInfo;
    1.29 -
    1.30 -   VPThdCond       **condDynArray;
    1.31 -   PrivDynArrayInfo *condDynArrayInfo;
    1.32 -
    1.33 -   void             *applicationGlobals;
    1.34 -
    1.35 -                       //fix limit on num with dynArray
    1.36 -   int32             singletonHasBeenExecutedFlags[NUM_STRUCS_IN_SEM_ENV];
    1.37 -   VPThdTrans        transactionStrucs[NUM_STRUCS_IN_SEM_ENV];
    1.38 +   int32           hasBeenStarted;
    1.39 +   int32           hasFinished;
    1.40 +   void           *endInstrAddr;
    1.41 +   PrivQueueStruc *waitQ;
    1.42   }
    1.43 -VPThdSemEnv;
    1.44 -
    1.45 +VPThdSingleton;
    1.46  
    1.47  typedef struct
    1.48   {
    1.49 @@ -140,6 +125,32 @@
    1.50  VPThdSemData;
    1.51  
    1.52  
    1.53 +typedef struct
    1.54 + {
    1.55 +      //Standard stuff will be in most every semantic env
    1.56 +   PrivQueueStruc  **readyVPQs;
    1.57 +   int32             numVirtPr;
    1.58 +   int32             nextCoreToGetNewPr;
    1.59 +   int32             primitiveStartTime;
    1.60 +
    1.61 +      //Specific to this semantic layer
    1.62 +   VPThdMutex      **mutexDynArray;
    1.63 +   PrivDynArrayInfo *mutexDynArrayInfo;
    1.64 +
    1.65 +   VPThdCond       **condDynArray;
    1.66 +   PrivDynArrayInfo *condDynArrayInfo;
    1.67 +
    1.68 +   void             *applicationGlobals;
    1.69 +
    1.70 +                       //fix limit on num with dynArray
    1.71 +   VPThdSingleton    singletons[NUM_STRUCS_IN_SEM_ENV];
    1.72 +   void             *singletonEndInstrAddr;
    1.73 +
    1.74 +   VPThdTrans        transactionStrucs[NUM_STRUCS_IN_SEM_ENV];
    1.75 + }
    1.76 +VPThdSemEnv;
    1.77 +
    1.78 +
    1.79  //===========================================================================
    1.80  
    1.81  inline void
    1.82 @@ -187,6 +198,24 @@
    1.83  VPThread__cond_signal( int32 condIdx, VirtProcr *signallingPr );
    1.84  
    1.85  
    1.86 +//=======================
    1.87 +
    1.88 +void
    1.89 +VPThread__end_singleton( int32 singletonID, VirtProcr *animPr );
    1.90 +
    1.91 +inline void
    1.92 +VPThread__start_singleton( int32 singletonID, VirtProcr *animPr );
    1.93 +
    1.94 +void
    1.95 +VPThread__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster,
    1.96 +                                         void *data, VirtProcr *animPr );
    1.97 +
    1.98 +void
    1.99 +VPThread__start_transaction( int32 transactionID, VirtProcr *animPr );
   1.100 +
   1.101 +void
   1.102 +VPThread__end_transaction( int32 transactionID, VirtProcr *animPr );
   1.103 +
   1.104  
   1.105  
   1.106  //=========================  Internal use only  =============================