Changeset 1095ccd
- Timestamp:
- Aug 14, 2020, 5:32:32 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- d2b5d2d
- Parents:
- a5bc72e
- Location:
- libcfa/src/concurrency
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/io.cfa
ra5bc72e r1095ccd 514 514 } 515 515 516 #define PARTIAL_SUBMIT 32 516 517 static unsigned __collect_submitions( struct __io_data & ring ) { 517 518 /* paranoid */ verify( ring.submit_q.ready != 0p ); … … 521 522 __u32 tail = *ring.submit_q.tail; 522 523 const __u32 mask = *ring.submit_q.mask; 524 #if defined(PARTIAL_SUBMIT) 525 #if defined(LEADER_LOCK) 526 #error PARTIAL_SUBMIT and LEADER_LOCK cannot co-exist 527 #endif 528 const __u32 cnt = ring.submit_q.ready_cnt > PARTIAL_SUBMIT ? PARTIAL_SUBMIT : ring.submit_q.ready_cnt; 529 const __u32 offset = ring.submit_q.prev_ready; 530 ring.submit_q.prev_ready += cnt; 531 #else 532 const __u32 cnt = ring.submit_q.ready_cnt; 533 const __u32 offset = 0; 534 #endif 523 535 524 536 // Go through the list of ready submissions 525 for( i; ring.submit_q.ready_cnt ) { 537 for( c; cnt ) { 538 __u32 i = (offset + c) % ring.submit_q.ready_cnt; 539 526 540 // replace any submission with the sentinel, to consume it. 527 541 __u32 idx = __atomic_exchange_n( &ring.submit_q.ready[i], -1ul32, __ATOMIC_RELAXED); -
libcfa/src/concurrency/io/setup.cfa
ra5bc72e r1095ccd 388 388 sq.ready[i] = -1ul32; 389 389 } 390 sq.prev_ready = 0; 390 391 } 391 392 else { 392 393 sq.ready_cnt = 0; 393 394 sq.ready = 0p; 395 sq.prev_ready = 0; 394 396 } 395 397 -
libcfa/src/concurrency/io/types.hfa
ra5bc72e r1095ccd 23 23 #include "bits/locks.hfa" 24 24 25 #define LEADER_LOCK25 // #define LEADER_LOCK 26 26 struct __leaderlock_t { 27 27 struct $thread * volatile value; // ($thread) next_leader | (bool:1) is_locked … … 55 55 volatile __u32 * ready; 56 56 __u32 ready_cnt; 57 __u32 prev_ready; 57 58 58 59 #if defined(LEADER_LOCK)
Note: See TracChangeset
for help on using the changeset viewer.