Changeset bae0d35 for libcfa/src/concurrency
- Timestamp:
- Jun 7, 2021, 2:09:12 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 5a46e09
- Parents:
- 82f4063 (diff), 53692b3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- libcfa/src/concurrency
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/coroutine.cfa
r82f4063 rbae0d35 267 267 struct $coroutine * cor = active_coroutine(); 268 268 269 // get the active thread once 270 $thread * athrd = active_thread(); 271 272 /* paranoid */ verify( athrd->corctx_flag ); 273 athrd->corctx_flag = false; 274 269 275 if(cor->state == Primed) { 270 276 __cfactx_suspend(); -
libcfa/src/concurrency/coroutine.hfa
r82f4063 rbae0d35 86 86 src->state = src->state == Halted ? Halted : Blocked; 87 87 88 // get the active thread once 89 $thread * athrd = active_thread(); 90 91 // Mark the coroutine 92 /* paranoid */ verify( !athrd->corctx_flag ); 93 athrd->corctx_flag = true; 94 88 95 // set new coroutine that task is executing 89 a ctive_thread()->curr_cor = dst;96 athrd->curr_cor = dst; 90 97 91 98 // context switch to specified coroutine 92 verify( dst->context.SP );99 /* paranoid */ verify( dst->context.SP ); 93 100 __cfactx_switch( &src->context, &dst->context ); 94 101 // when __cfactx_switch returns we are back in the src coroutine 102 103 /* paranoid */ verify( athrd->corctx_flag ); 104 athrd->corctx_flag = false; 95 105 96 106 // set state of new coroutine to active -
libcfa/src/concurrency/invoke.h
r82f4063 rbae0d35 168 168 enum __Preemption_Reason preempted:8; 169 169 170 bool corctx_flag; 171 170 172 //SKULLDUGGERY errno is not save in the thread data structure because returnToKernel appears to be the only function to require saving and restoring it 171 173 -
libcfa/src/concurrency/kernel.cfa
r82f4063 rbae0d35 413 413 /* paranoid */ verify( thrd_dst->context.SP ); 414 414 /* paranoid */ verify( thrd_dst->state != Halted ); 415 /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) < ((uintptr_t)__get_stack(thrd_dst->curr_cor)->base ) || thrd_dst->curr_cor == proc_cor , "ERROR : Destination $thread %p has been corrupted.\n StackPointer too small.\n", thrd_dst ); // add escape condition if we are setting up the processor416 /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) > ((uintptr_t)__get_stack(thrd_dst->curr_cor)->limit) || thrd_dst->curr_cor == proc_cor , "ERROR : Destination $thread %p has been corrupted.\n StackPointer too large.\n", thrd_dst ); // add escape condition if we are setting up the processor415 /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) < ((uintptr_t)__get_stack(thrd_dst->curr_cor)->base ) || thrd_dst->curr_cor == proc_cor || thrd_dst->corctx_flag, "ERROR : Destination $thread %p has been corrupted.\n StackPointer too small.\n", thrd_dst ); // add escape condition if we are setting up the processor 416 /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) > ((uintptr_t)__get_stack(thrd_dst->curr_cor)->limit) || thrd_dst->curr_cor == proc_cor || thrd_dst->corctx_flag, "ERROR : Destination $thread %p has been corrupted.\n StackPointer too large.\n", thrd_dst ); // add escape condition if we are setting up the processor 417 417 /* paranoid */ verify( 0x0D15EA5E0D15EA5Ep == thrd_dst->canary ); 418 418 … … 424 424 425 425 /* paranoid */ verify( 0x0D15EA5E0D15EA5Ep == thrd_dst->canary ); 426 /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) > ((uintptr_t)__get_stack(thrd_dst->curr_cor)->limit) , "ERROR : Destination $thread %p has been corrupted.\n StackPointer too large.\n", thrd_dst );427 /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) < ((uintptr_t)__get_stack(thrd_dst->curr_cor)->base ) , "ERROR : Destination $thread %p has been corrupted.\n StackPointer too small.\n", thrd_dst );426 /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) > ((uintptr_t)__get_stack(thrd_dst->curr_cor)->limit) || thrd_dst->corctx_flag, "ERROR : Destination $thread %p has been corrupted.\n StackPointer too large.\n", thrd_dst ); 427 /* paranoid */ verifyf( ((uintptr_t)thrd_dst->context.SP) < ((uintptr_t)__get_stack(thrd_dst->curr_cor)->base ) || thrd_dst->corctx_flag, "ERROR : Destination $thread %p has been corrupted.\n StackPointer too small.\n", thrd_dst ); 428 428 /* paranoid */ verify( thrd_dst->context.SP ); 429 429 /* paranoid */ verify( thrd_dst->curr_cluster == this->cltr ); -
libcfa/src/concurrency/kernel/startup.cfa
r82f4063 rbae0d35 397 397 // make sure the current state is still correct 398 398 /* paranoid */ verify(src->state == Ready); 399 src->corctx_flag = true; 399 400 400 401 // context switch to specified coroutine -
libcfa/src/concurrency/thread.cfa
r82f4063 rbae0d35 32 32 state = Start; 33 33 preempted = __NO_PREEMPTION; 34 corctx_flag = false; 34 35 curr_cor = &self_cor; 35 36 self_mon.owner = &this;
Note: See TracChangeset
for help on using the changeset viewer.