Ignore:
Timestamp:
Jun 12, 2020, 1:49:17 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
cb196f2
Parents:
b388ee81
Message:

Changed scheduling API to adapt to non-Processors scheduling threads.

File:
1 edited

Legend:

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

    rb388ee81 r9b1dcc2  
    3939// FwdDeclarations : timeout handlers
    4040static void preempt( processor   * this );
    41 static void timeout( $thread * this );
     41static void timeout( struct __processor_id_t * id, $thread * this );
    4242
    4343// FwdDeclarations : Signal handlers
     
    9090
    9191// Tick one frame of the Discrete Event Simulation for alarms
    92 static void tick_preemption() {
     92static void tick_preemption( struct __processor_id_t * id ) {
    9393        alarm_node_t * node = 0p;                                                       // Used in the while loop but cannot be declared in the while condition
    9494        alarm_list_t * alarms = &event_kernel->alarms;          // Local copy for ease of reading
     
    108108                }
    109109                else {
    110                         timeout( node->thrd );
     110                        timeout( id, node->thrd );
    111111                }
    112112
     
    268268
    269269// reserved for future use
    270 static void timeout( $thread * this ) {
    271         __unpark( this __cfaabi_dbg_ctx2 );
     270static void timeout( struct __processor_id_t * id, $thread * this ) {
     271        __unpark( id, this __cfaabi_dbg_ctx2 );
    272272}
    273273
     
    405405// Waits on SIGALRM and send SIGUSR1 to whom ever needs it
    406406static void * alarm_loop( __attribute__((unused)) void * args ) {
     407        __processor_id_t id;
     408        id.id = doregister(&id);
     409
    407410        // Block sigalrms to control when they arrive
    408411        sigset_t mask;
     
    449452                        // __cfaabi_dbg_print_safe( "Kernel : Preemption thread tick\n" );
    450453                        lock( event_kernel->lock __cfaabi_dbg_ctx2 );
    451                         tick_preemption();
     454                        tick_preemption( &id );
    452455                        unlock( event_kernel->lock );
    453456                        break;
     
    462465EXIT:
    463466        __cfaabi_dbg_print_safe( "Kernel : Preemption thread stopping\n" );
     467        unregister(&id);
    464468        return 0p;
    465469}
Note: See TracChangeset for help on using the changeset viewer.