Ignore:
Timestamp:
Mar 17, 2021, 1:56:12 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
c407434e
Parents:
e0c072c
Message:

C interface now runs worker init routine in dedicated thread.
Also added test for this case.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/kernel/startup.cfa

    re0c072c ra5e7233  
    7373static void __kernel_first_resume( processor * this );
    7474static void __kernel_last_resume ( processor * this );
    75 static void init(processor & this, const char name[], cluster & _cltr, void (*fnc) (void *), void * arg);
     75static void init(processor & this, const char name[], cluster & _cltr, $thread * initT);
    7676static void deinit(processor & this);
    7777static void doregister( struct cluster & cltr );
     
    198198                ( this.terminated ){};
    199199                ( this.runner ){};
    200                 init( this, "Main Processor", *mainCluster, 0p, 0p );
     200                init( this, "Main Processor", *mainCluster, 0p );
    201201                kernel_thread = pthread_self();
    202202
     
    452452}
    453453
    454 static void init(processor & this, const char name[], cluster & _cltr, void (*fnc) (void *), void * arg) with( this ) {
     454static void init(processor & this, const char name[], cluster & _cltr, $thread * initT) with( this ) {
    455455        this.name = name;
    456456        this.cltr = &_cltr;
     
    464464        this.io.dirty   = false;
    465465
    466         this.init.fnc = fnc;
    467         this.init.arg = arg;
     466        this.init.thrd = initT;
    468467
    469468        this.idle = eventfd(0, 0);
     
    516515}
    517516
    518 void ?{}(processor & this, const char name[], cluster & _cltr, void (*fnc) (void *), void * arg) {
     517void ?{}(processor & this, const char name[], cluster & _cltr, $thread * initT) {
    519518        ( this.terminated ){};
    520519        ( this.runner ){};
    521520
    522521        disable_interrupts();
    523                 init( this, name, _cltr, fnc, arg );
     522                init( this, name, _cltr, initT );
    524523        enable_interrupts( __cfaabi_dbg_ctx );
    525524
     
    527526
    528527        this.stack = __create_pthread( &this.kernel_thread, __invoke_processor, (void *)&this );
    529 
     528}
     529
     530void ?{}(processor & this, const char name[], cluster & _cltr) {
     531        (this){name, _cltr, 0p};
    530532}
    531533
Note: See TracChangeset for help on using the changeset viewer.