Ignore:
Timestamp:
Feb 13, 2020, 4:18:07 PM (22 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr
Children:
50b8885
Parents:
9f575ea
Message:

Added park/unpark primitives thread and removed BlockInternal?.
Converted monitors to use park unpark.
Intrusive Queue now mark next field when thread is inside queue.
Added several asserts to kernel and monitor.
Added a few tests for park and unpark.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/thread.cfa

    r9f575ea r3381ed7  
    3636        self_cor{ name, storage, storageSize };
    3737        state = Start;
    38         preempted = false;
     38        preempted = __NO_PREEMPTION;
    3939        curr_cor = &self_cor;
    4040        self_mon.owner = &this;
     
    7878void __thrd_start( T & this, void (*main_p)(T &) ) {
    7979        thread_desc * this_thrd = get_thread(this);
    80         thread_desc * curr_thrd = TL_GET( this_thread );
    8180
    8281        disable_interrupts();
     
    8584        this_thrd->context.[SP, FP] = this_thrd->self_cor.context.[SP, FP];
    8685        verify( this_thrd->context.SP );
    87         // CtxSwitch( &curr_thrd->context, &this_thrd->context );
    8886
    8987        ScheduleThread(this_thrd);
    9088        enable_interrupts( __cfaabi_dbg_ctx );
    91 }
    92 
    93 void yield( void ) {
    94         // Safety note : This could cause some false positives due to preemption
    95       verify( TL_GET( preemption_state.enabled ) );
    96         BlockInternal( TL_GET( this_thread ) );
    97         // Safety note : This could cause some false positives due to preemption
    98       verify( TL_GET( preemption_state.enabled ) );
    99 }
    100 
    101 void yield( unsigned times ) {
    102         for( unsigned i = 0; i < times; i++ ) {
    103                 yield();
    104         }
    10589}
    10690
Note: See TracChangeset for help on using the changeset viewer.