Changeset 7a2972b for libcfa/src/concurrency/ready_queue.cfa
- Timestamp:
- Apr 1, 2021, 9:02:57 PM (2 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 7ee3c87
- Parents:
- c426b03
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/ready_queue.cfa
rc426b03 r7a2972b 18 18 19 19 // #define USE_SNZI 20 // #define USE_MPSC 20 21 21 22 #include "bits/defs.hfa" … … 284 285 #endif 285 286 287 #if defined(USE_MPSC) 288 // mpsc always succeeds 289 } while( false ); 290 #else 286 291 // If we can't lock it retry 287 292 } while( !__atomic_try_acquire( &lanes.data[i].lock ) ); 293 #endif 288 294 289 295 // Actually push it … … 305 311 #endif 306 312 307 // Unlock and return 308 __atomic_unlock( &lanes.data[i].lock ); 313 #if !defined(USE_MPSC) 314 // Unlock and return 315 __atomic_unlock( &lanes.data[i].lock ); 316 #endif 309 317 310 318 // Mark the current index in the tls rng instance as having an item … … 493 501 494 502 static void check( __ready_queue_t & q ) with (q) { 495 #if defined(__CFA_WITH_VERIFY__) 503 #if defined(__CFA_WITH_VERIFY__) && !defined(USE_MPSC) 496 504 { 497 505 for( idx ; lanes.count ) { … … 504 512 assert(tail(sl)->link.prev->link.next == tail(sl) ); 505 513 506 if( sl.before.link.ts == 0l) {514 if(is_empty(sl)) { 507 515 assert(tail(sl)->link.prev == head(sl)); 508 516 assert(head(sl)->link.next == tail(sl)); … … 519 527 // fixes the list so that the pointers back to anchors aren't left dangling 520 528 static inline void fix(__intrusive_lane_t & ll) { 521 // if the list is not empty then follow he pointer and fix its reverse 522 if(!is_empty(ll)) { 523 head(ll)->link.next->link.prev = head(ll); 524 tail(ll)->link.prev->link.next = tail(ll); 525 } 526 // Otherwise just reset the list 527 else { 528 verify(tail(ll)->link.next == 0p); 529 tail(ll)->link.prev = head(ll); 530 head(ll)->link.next = tail(ll); 531 verify(head(ll)->link.prev == 0p); 532 } 529 #if !defined(USE_MPSC) 530 // if the list is not empty then follow he pointer and fix its reverse 531 if(!is_empty(ll)) { 532 head(ll)->link.next->link.prev = head(ll); 533 tail(ll)->link.prev->link.next = tail(ll); 534 } 535 // Otherwise just reset the list 536 else { 537 verify(tail(ll)->link.next == 0p); 538 tail(ll)->link.prev = head(ll); 539 head(ll)->link.next = tail(ll); 540 verify(head(ll)->link.prev == 0p); 541 } 542 #endif 533 543 } 534 544
Note: See TracChangeset
for help on using the changeset viewer.