Ignore:
Timestamp:
Oct 29, 2019, 4:01:24 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:
773db65, 9421f3d8
Parents:
7951100 (diff), 8364209 (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 moved

Legend:

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

    r7951100 rb067d9b  
    1414//
    1515
    16 #include "preemption.h"
     16#define __cforall_thread__
     17
     18#include "preemption.hfa"
    1719#include <assert.h>
    1820
     
    2426}
    2527
    26 #include "bits/signal.h"
     28#include "bits/signal.hfa"
    2729
    2830#if !defined(__CFA_DEFAULT_PREEMPTION__)
     
    3941
    4042// FwdDeclarations : Signal handlers
    41 void sigHandler_ctxSwitch( __CFA_SIGPARMS__ );
    42 void sigHandler_segv     ( __CFA_SIGPARMS__ );
    43 void sigHandler_ill      ( __CFA_SIGPARMS__ );
    44 void sigHandler_fpe      ( __CFA_SIGPARMS__ );
    45 void sigHandler_abort    ( __CFA_SIGPARMS__ );
     43static void sigHandler_ctxSwitch( __CFA_SIGPARMS__ );
     44static void sigHandler_segv     ( __CFA_SIGPARMS__ );
     45static void sigHandler_ill      ( __CFA_SIGPARMS__ );
     46static void sigHandler_fpe      ( __CFA_SIGPARMS__ );
     47static void sigHandler_abort    ( __CFA_SIGPARMS__ );
    4648
    4749// FwdDeclarations : alarm thread main
    48 void * alarm_loop( __attribute__((unused)) void * args );
     50static void * alarm_loop( __attribute__((unused)) void * args );
    4951
    5052// Machine specific register name
     
    6365static pthread_t alarm_thread;                        // pthread handle to alarm thread
    6466
    65 void ?{}(event_kernel_t & this) with( this ) {
     67static void ?{}(event_kernel_t & this) with( this ) {
    6668        alarms{};
    6769        lock{};
     
    8587
    8688// Tick one frame of the Discrete Event Simulation for alarms
    87 void tick_preemption() {
     89static void tick_preemption() {
    8890        alarm_node_t * node = NULL;                     // Used in the while loop but cannot be declared in the while condition
    8991        alarm_list_t * alarms = &event_kernel->alarms;  // Local copy for ease of reading
     
    263265}
    264266
    265 // kill wrapper : signal a processor
    266 void terminate(processor * this) {
    267         disable_interrupts();
    268         __atomic_store_n(&this->do_terminate, true, __ATOMIC_SEQ_CST);
    269         wake( this );
    270         sigval_t value = { PREEMPT_TERMINATE };
    271         enable_interrupts( __cfaabi_dbg_ctx );
    272         pthread_sigqueue( this->kernel_thread, SIGUSR1, value );
    273 }
    274 
    275267// reserved for future use
    276268static void timeout( thread_desc * this ) {
     
    360352// Context switch signal handler
    361353// Receives SIGUSR1 signal and causes the current thread to yield
    362 void sigHandler_ctxSwitch( __CFA_SIGPARMS__ ) {
     354static void sigHandler_ctxSwitch( __CFA_SIGPARMS__ ) {
    363355        __cfaabi_dbg_debug_do( last_interrupt = (void *)(cxt->uc_mcontext.CFA_REG_IP); )
    364356
     
    403395// Main of the alarm thread
    404396// Waits on SIGALRM and send SIGUSR1 to whom ever needs it
    405 void * alarm_loop( __attribute__((unused)) void * args ) {
     397static void * alarm_loop( __attribute__((unused)) void * args ) {
    406398        // Block sigalrms to control when they arrive
    407399        sigset_t mask;
Note: See TracChangeset for help on using the changeset viewer.