Changeset 1993 in Sophya for trunk/ArchTOIPipe
- Timestamp:
- May 9, 2002, 10:22:37 PM (23 years ago)
- Location:
- trunk/ArchTOIPipe/Kernel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ArchTOIPipe/Kernel/toi.h
r1766 r1993 5 5 // Christophe Magneville 6 6 // Reza Ansari 7 // $Id: toi.h,v 1.1 5 2001-11-14 14:49:05 aubourgExp $7 // $Id: toi.h,v 1.16 2002-05-09 20:22:37 ansari Exp $ 8 8 9 9 #ifndef TOI_H … … 127 127 128 128 // ----- Rajouts Reza 12/3/2001 129 void wait() {pthread_cond_wait(&condv, &mutex);}130 void signal() {pthread_cond_signal(&condv);}131 void broadcast() {pthread_cond_broadcast(&condv);}129 inline void wait() {pthread_cond_wait(&condv, &mutex);} 130 inline void signal() {pthread_cond_signal(&condv);} 131 inline void broadcast() {pthread_cond_broadcast(&condv);} 132 132 inline void waitPut() 133 133 {fgwaitput=true; countwaitput++; pthread_cond_wait(&condv, &mutex);} … … 136 136 inline bool isPutWaiting() const { return fgwaitput; } 137 137 inline bool isGetWaiting() const { return fgwaitget; } 138 inline void signalPut() {fgsigput=true; }139 inline void signalGet() {fgsigget=true; }138 inline void signalPut() {fgsigput=true; } 139 inline void signalGet() {fgsigget=true; } 140 140 inline void cleanWaitPut() { fgsigput = fgwaitput = false; } 141 141 inline void cleanWaitGet() { fgsigget = fgwaitget = false; } -
trunk/ArchTOIPipe/Kernel/toiseqbuff.cc
r1992 r1993 3 3 // Christophe Magneville 4 4 // Reza Ansari 5 // $Id: toiseqbuff.cc,v 1.1 2 2002-05-08 22:22:33ansari Exp $5 // $Id: toiseqbuff.cc,v 1.13 2002-05-09 20:22:37 ansari Exp $ 6 6 7 7 #include "toiprocessor.h" … … 125 125 126 126 void TOISeqBuffered::getData(int i, double & val, uint_8 & flg) { 127 lock(); 127 128 if (!started) { 128 129 cout << " TOISeqBuffered::getData() - waitGet() Waiting for start ... " << endl; … … 135 136 << " i=" << i << " next_in= " << next_in 136 137 << " next_out=" << next_out << endl; 138 unlock(); 137 139 throw RangeCheckError("TOISeqBuffered::getData(i) : data deleted"); 138 140 } … … 158 160 << " i=" << i << " next_in= " << next_in 159 161 << " next_out=" << next_out << endl; 160 signalPut(); broadcast(); 161 } 162 signalPut(); 163 } 164 unlock(); 165 if (fgsigput) signal(); 162 166 return; 163 167 } … … 166 170 void TOISeqBuffered::getData(int i, int n, double* data, uint_8* flg) 167 171 { 172 lock(); 168 173 if (!started) { 169 174 cout << " TOISeqBuffered::getData(i,n ...) - waitGet() Waiting for start ... " << endl; … … 176 181 << " i=" << i << " next_in= " << next_in 177 182 << " next_out=" << next_out << endl; 183 unlock(); 178 184 throw RangeCheckError("TOISeqBuffered::getData(i) : data deleted"); 179 185 } … … 200 206 << " i=" << i << " next_in= " << next_in 201 207 << " next_out=" << next_out << endl; 202 signalPut(); broadcast(); 203 } 204 } 205 return; 206 208 signalPut(); 209 } 210 } 211 unlock(); 212 if (fgsigput) signal(); 213 return; 207 214 } 208 215 … … 238 245 239 246 void TOISeqBuffered::putData(int i, double value, uint_8 flag) { 247 lock(); 240 248 if (!started) { 241 249 first_in = next_in = i; … … 250 258 << " next_out=" << next_out << endl; 251 259 string msg = "TOISeqBuffered::putData() : i!=next_in TOIname=" + getName(); 260 unlock(); 252 261 throw RangeCheckError(msg); 253 262 } … … 272 281 << " i=" << i << " next_in= " << next_in 273 282 << " next_out=" << next_out << endl; 274 signalGet(); broadcast(); 275 } 276 } 277 278 void TOISeqBuffered::putData(int i, int n, double const* val, uint_8 const* flg) { 283 signalGet(); 284 } 285 unlock(); 286 if (fgsigget) signal(); 287 return; 288 } 289 290 void TOISeqBuffered::putData(int i, int n, double const* val, uint_8 const* flg) 291 { 292 lock(); 279 293 if (!started) { 280 294 first_in = next_in = i; … … 289 303 << " next_out=" << next_out << endl; 290 304 string msg = "TOISeqBuffered::putData() : i!=next_in TOIname=" + getName(); 305 unlock(); 291 306 throw RangeCheckError(msg); 292 307 } … … 314 329 << " i=" << i << " next_in= " << next_in 315 330 << " next_out=" << next_out << endl; 316 signalGet(); broadcast(); 317 } 331 signalGet(); 332 } 333 unlock(); 334 if (fgsigget) signal(); 335 return; 318 336 } 319 337
Note:
See TracChangeset
for help on using the changeset viewer.