- Timestamp:
- Apr 24, 2021, 7:36:42 PM (3 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 89eff25
- Parents:
- 5c04e82
- Location:
- libcfa/src/concurrency
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel.cfa
r5c04e82 rfc59df78 488 488 489 489 ready_schedule_lock(); 490 $thread * thrd = pop_slow( this ); 490 $thread * thrd; 491 for(25) { 492 thrd = pop_slow( this ); 493 if(thrd) goto RET; 494 } 495 thrd = pop_search( this ); 496 497 RET: 491 498 ready_schedule_unlock(); 492 499 -
libcfa/src/concurrency/kernel_private.hfa
r5c04e82 rfc59df78 289 289 290 290 //----------------------------------------------------------------------- 291 // pop thread from the ready queueof a cluster291 // pop thread from the local queues of a cluster 292 292 // returns 0p if empty 293 293 // May return 0p spuriously … … 295 295 296 296 //----------------------------------------------------------------------- 297 // pop thread from the ready queue of a cluster 297 // pop thread from any ready queue of a cluster 298 // returns 0p if empty 299 // May return 0p spuriously 300 __attribute__((hot)) struct $thread * pop_slow(struct cluster * cltr); 301 302 //----------------------------------------------------------------------- 303 // search all ready queues of a cluster for any thread 298 304 // returns 0p if empty 299 305 // guaranteed to find any threads added before this call 300 __attribute__((hot)) struct $thread * pop_s low(struct cluster * cltr);306 __attribute__((hot)) struct $thread * pop_search(struct cluster * cltr); 301 307 302 308 //----------------------------------------------------------------------- -
libcfa/src/concurrency/ready_queue.cfa
r5c04e82 rfc59df78 344 344 } 345 345 346 __attribute__((hot)) struct $thread * pop_slow(struct cluster * cltr) { 346 __attribute__((hot)) struct $thread * pop_slow(struct cluster * cltr) { return pop_fast(cltr); } 347 __attribute__((hot)) struct $thread * pop_search(struct cluster * cltr) { 347 348 return search(cltr); 348 349 } … … 436 437 437 438 __attribute__((hot)) struct $thread * pop_slow(struct cluster * cltr) with (cltr->ready_queue) { 438 for(25) { 439 unsigned i = __tls_rand() % lanes.count; 440 $thread * t = try_pop(cltr, i __STATS(, __tls_stats()->ready.pop.steal)); 441 if(t) return t; 442 } 443 439 unsigned i = __tls_rand() % lanes.count; 440 return try_pop(cltr, i __STATS(, __tls_stats()->ready.pop.steal)); 441 } 442 443 __attribute__((hot)) struct $thread * pop_search(struct cluster * cltr) with (cltr->ready_queue) { 444 444 return search(cltr); 445 445 }
Note: See TracChangeset
for help on using the changeset viewer.