comparison 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
comparison
equal deleted inserted replaced
1:3e4a0a56c597 2:b518dd4802ce
43 cond_wait, 43 cond_wait,
44 cond_signal, 44 cond_signal,
45 make_procr, 45 make_procr,
46 malloc_req, 46 malloc_req,
47 free_req, 47 free_req,
48 singleton, 48 singleton_start,
49 singleton_end,
49 atomic, 50 atomic,
50 trans_start, 51 trans_start,
51 trans_end 52 trans_end
52 }; 53 };
53 54
80 VirtProcr *VPCurrentlyExecuting; 81 VirtProcr *VPCurrentlyExecuting;
81 PrivQueueStruc *waitingVPQ; 82 PrivQueueStruc *waitingVPQ;
82 } 83 }
83 VPThdTrans; 84 VPThdTrans;
84 85
86 typedef struct
87 {
88 int32 hasBeenStarted;
89 int32 hasFinished;
90 void *endInstrAddr;
91 PrivQueueStruc *waitQ;
92 }
93 VPThdSingleton;
94
95 typedef struct
96 {
97 int32 mutexIdx;
98 VirtProcr *holderOfLock;
99 PrivQueueStruc *waitingQueue;
100 }
101 VPThdMutex;
102
103
104 typedef struct
105 {
106 int32 condIdx;
107 PrivQueueStruc *waitingQueue;
108 VPThdMutex *partnerMutex;
109 }
110 VPThdCond;
111
112 typedef struct _TransListElem TransListElem;
113 struct _TransListElem
114 {
115 int32 transID;
116 TransListElem *nextTrans;
117 };
118 //TransListElem
119
120 typedef struct
121 {
122 int32 highestTransEntered;
123 TransListElem *lastTransEntered;
124 }
125 VPThdSemData;
126
85 127
86 typedef struct 128 typedef struct
87 { 129 {
88 //Standard stuff will be in most every semantic env 130 //Standard stuff will be in most every semantic env
89 PrivQueueStruc **readyVPQs; 131 PrivQueueStruc **readyVPQs;
99 PrivDynArrayInfo *condDynArrayInfo; 141 PrivDynArrayInfo *condDynArrayInfo;
100 142
101 void *applicationGlobals; 143 void *applicationGlobals;
102 144
103 //fix limit on num with dynArray 145 //fix limit on num with dynArray
104 int32 singletonHasBeenExecutedFlags[NUM_STRUCS_IN_SEM_ENV]; 146 VPThdSingleton singletons[NUM_STRUCS_IN_SEM_ENV];
147 void *singletonEndInstrAddr;
148
105 VPThdTrans transactionStrucs[NUM_STRUCS_IN_SEM_ENV]; 149 VPThdTrans transactionStrucs[NUM_STRUCS_IN_SEM_ENV];
106 } 150 }
107 VPThdSemEnv; 151 VPThdSemEnv;
108
109
110 typedef struct
111 {
112 int32 mutexIdx;
113 VirtProcr *holderOfLock;
114 PrivQueueStruc *waitingQueue;
115 }
116 VPThdMutex;
117
118
119 typedef struct
120 {
121 int32 condIdx;
122 PrivQueueStruc *waitingQueue;
123 VPThdMutex *partnerMutex;
124 }
125 VPThdCond;
126
127 typedef struct _TransListElem TransListElem;
128 struct _TransListElem
129 {
130 int32 transID;
131 TransListElem *nextTrans;
132 };
133 //TransListElem
134
135 typedef struct
136 {
137 int32 highestTransEntered;
138 TransListElem *lastTransEntered;
139 }
140 VPThdSemData;
141 152
142 153
143 //=========================================================================== 154 //===========================================================================
144 155
145 inline void 156 inline void
185 196
186 inline void * 197 inline void *
187 VPThread__cond_signal( int32 condIdx, VirtProcr *signallingPr ); 198 VPThread__cond_signal( int32 condIdx, VirtProcr *signallingPr );
188 199
189 200
201 //=======================
202
203 void
204 VPThread__end_singleton( int32 singletonID, VirtProcr *animPr );
205
206 inline void
207 VPThread__start_singleton( int32 singletonID, VirtProcr *animPr );
208
209 void
210 VPThread__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster,
211 void *data, VirtProcr *animPr );
212
213 void
214 VPThread__start_transaction( int32 transactionID, VirtProcr *animPr );
215
216 void
217 VPThread__end_transaction( int32 transactionID, VirtProcr *animPr );
218
190 219
191 220
192 //========================= Internal use only ============================= 221 //========================= Internal use only =============================
193 inline void 222 inline void
194 VPThread__Request_Handler( VirtProcr *requestingPr, void *_semEnv ); 223 VPThread__Request_Handler( VirtProcr *requestingPr, void *_semEnv );