Ignore:
Timestamp:
Feb 27, 2020, 4:04:25 PM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
a037f85
Parents:
41efd33 (diff), 930b504 (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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

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

    r41efd33 r04e6f93  
    3939// FwdDeclarations : timeout handlers
    4040static void preempt( processor   * this );
    41 static void timeout( thread_desc * this );
     41static void timeout( $thread * this );
    4242
    4343// FwdDeclarations : Signal handlers
     
    184184
    185185        // Enable interrupts by decrementing the counter
    186         // If counter reaches 0, execute any pending CtxSwitch
     186        // If counter reaches 0, execute any pending __cfactx_switch
    187187        void enable_interrupts( __cfaabi_dbg_ctx_param ) {
    188188                processor   * proc = kernelTLS.this_processor; // Cache the processor now since interrupts can start happening after the atomic store
    189                 thread_desc * thrd = kernelTLS.this_thread;       // Cache the thread now since interrupts can start happening after the atomic store
    190189
    191190                with( kernelTLS.preemption_state ){
     
    209208                                if( proc->pending_preemption ) {
    210209                                        proc->pending_preemption = false;
    211                                         BlockInternal( thrd );
     210                                        force_yield( __POLL_PREEMPTION );
    212211                                }
    213212                        }
     
    219218
    220219        // Disable interrupts by incrementint the counter
    221         // Don't execute any pending CtxSwitch even if counter reaches 0
     220        // Don't execute any pending __cfactx_switch even if counter reaches 0
    222221        void enable_interrupts_noPoll() {
    223222                unsigned short prev = kernelTLS.preemption_state.disable_count;
     
    268267
    269268// reserved for future use
    270 static void timeout( thread_desc * this ) {
     269static void timeout( $thread * this ) {
    271270        //TODO : implement waking threads
    272271}
    273272
    274273// KERNEL ONLY
    275 // Check if a CtxSwitch signal handler shoud defer
     274// Check if a __cfactx_switch signal handler shoud defer
    276275// If true  : preemption is safe
    277276// If false : preemption is unsafe and marked as pending
     
    303302
    304303        // Setup proper signal handlers
    305         __cfaabi_sigaction( SIGUSR1, sigHandler_ctxSwitch, SA_SIGINFO | SA_RESTART ); // CtxSwitch handler
     304        __cfaabi_sigaction( SIGUSR1, sigHandler_ctxSwitch, SA_SIGINFO | SA_RESTART ); // __cfactx_switch handler
    306305
    307306        signal_block( SIGALRM );
    308307
    309         alarm_stack = create_pthread( &alarm_thread, alarm_loop, 0p );
     308        alarm_stack = __create_pthread( &alarm_thread, alarm_loop, 0p );
    310309}
    311310
     
    394393        // Preemption can occur here
    395394
    396         BlockInternal( kernelTLS.this_thread ); // Do the actual CtxSwitch
     395        force_yield( __ALARM_PREEMPTION ); // Do the actual __cfactx_switch
    397396}
    398397
Note: See TracChangeset for help on using the changeset viewer.