- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/locks.cfa
rdff1fd1 rd25b2d6 17 17 this.t = t; 18 18 this.lock = 0p; 19 this.listed = false; 19 20 } 20 21 … … 24 25 this.info = info; 25 26 this.lock = 0p; 27 this.listed = false; 26 28 } 27 29 … … 34 36 info_thread(L) *& Next( info_thread(L) * this ) { 35 37 return (info_thread(L) *)Next( (Colable *)this ); 38 } 39 40 bool listed( info_thread(L) * this ) { 41 return Next( (Colable *)this ) != 0p; 36 42 } 37 43 } … … 188 194 // This condition_variable member is called from the kernel, and therefore, cannot block, but it can spin. 189 195 lock( cond->lock __cfaabi_dbg_ctx2 ); 190 if ( listed(i) ) { // is thread on queue191 i->signalled = false;196 197 if ( i->listed ) { // is thread on queue 192 198 cond->last_thread = i; // REMOVE THIS AFTER DEBUG 193 199 remove( cond->blocked_threads, *i ); //remove this thread O(1) … … 221 227 void process_popped( condition_variable(L) & this, info_thread(L) & popped ) with( this ) { 222 228 if(&popped != 0p) { 223 popped. signalled = true;229 popped.listed = false; 224 230 count--; 225 231 if (popped.lock) { … … 260 266 addTail( blocked_threads, *i ); 261 267 count++; 268 i->listed = true; 262 269 size_t recursion_count = 0; 263 270 if (i->lock) { … … 301 308 } 302 309 303 boolwait( condition_variable(L) & this, Duration duration ) with(this) {310 void wait( condition_variable(L) & this, Duration duration ) with(this) { 304 311 info_thread( L ) i = { active_thread() }; 305 312 queue_info_thread_timeout(this, i, __kernel_get_time() + duration ); 306 return i.signalled; 307 } 308 309 bool wait( condition_variable(L) & this, uintptr_t info, Duration duration ) with(this) { 313 } 314 315 void wait( condition_variable(L) & this, uintptr_t info, Duration duration ) with(this) { 310 316 info_thread( L ) i = { active_thread(), info }; 311 317 queue_info_thread_timeout(this, i, __kernel_get_time() + duration ); 312 return i.signalled; 313 } 314 315 bool wait( condition_variable(L) & this, Time time ) with(this) { 318 } 319 320 void wait( condition_variable(L) & this, Time time ) with(this) { 316 321 info_thread( L ) i = { active_thread() }; 317 322 queue_info_thread_timeout(this, i, time); 318 return i.signalled; 319 } 320 321 bool wait( condition_variable(L) & this, uintptr_t info, Time time ) with(this) { 323 } 324 325 void wait( condition_variable(L) & this, uintptr_t info, Time time ) with(this) { 322 326 info_thread( L ) i = { active_thread(), info }; 323 327 queue_info_thread_timeout(this, i, time); 324 return i.signalled;325 328 } 326 329 … … 337 340 } 338 341 339 boolwait( condition_variable(L) & this, L & l, Duration duration ) with(this) {342 void wait( condition_variable(L) & this, L & l, Duration duration ) with(this) { 340 343 info_thread(L) i = { active_thread() }; 341 344 i.lock = &l; 342 345 queue_info_thread_timeout(this, i, __kernel_get_time() + duration ); 343 return i.signalled; 344 } 345 346 bool wait( condition_variable(L) & this, L & l, uintptr_t info, Duration duration ) with(this) { 346 } 347 348 void wait( condition_variable(L) & this, L & l, uintptr_t info, Duration duration ) with(this) { 347 349 info_thread(L) i = { active_thread(), info }; 348 350 i.lock = &l; 349 351 queue_info_thread_timeout(this, i, __kernel_get_time() + duration ); 350 return i.signalled; 351 } 352 353 bool wait( condition_variable(L) & this, L & l, Time time ) with(this) { 352 } 353 354 void wait( condition_variable(L) & this, L & l, Time time ) with(this) { 354 355 info_thread(L) i = { active_thread() }; 355 356 i.lock = &l; 356 357 queue_info_thread_timeout(this, i, time ); 357 return i.signalled; 358 } 359 360 bool wait( condition_variable(L) & this, L & l, uintptr_t info, Time time ) with(this) { 358 } 359 360 void wait( condition_variable(L) & this, L & l, uintptr_t info, Time time ) with(this) { 361 361 info_thread(L) i = { active_thread(), info }; 362 362 i.lock = &l; 363 363 queue_info_thread_timeout(this, i, time ); 364 return i.signalled; 365 } 366 } 364 } 365 }
Note: See TracChangeset
for help on using the changeset viewer.