Ignore:
File:
1 edited

Legend:

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

    ra017ee7 r73f4d08  
    469469        this.name = name;
    470470        this.cltr = &_cltr;
    471         this.cltr_id = -1u;
    472471        do_terminate = false;
    473472        preemption_alarm = 0p;
     
    490489        #endif
    491490
    492         // Register and Lock the RWlock so no-one pushes/pops while we are changing the queue
    493         uint_fast32_t last_size = ready_mutate_register((__processor_id_t*)&this);
    494                 this.cltr->procs.total += 1u;
    495                 insert_last(this.cltr->procs.actives, this);
     491        lock( this.cltr->idles );
     492                int target = this.cltr->idles.total += 1u;
     493        unlock( this.cltr->idles );
     494
     495        id = doregister((__processor_id_t*)&this);
     496
     497        // Lock the RWlock so no-one pushes/pops while we are changing the queue
     498        uint_fast32_t last_size = ready_mutate_lock();
    496499
    497500                // Adjust the ready queue size
    498                 ready_queue_grow( cltr );
     501                this.cltr_id = ready_queue_grow( cltr, target );
    499502
    500503        // Unlock the RWlock
     
    506509// Not a ctor, it just preps the destruction but should not destroy members
    507510static void deinit(processor & this) {
     511        lock( this.cltr->idles );
     512                int target = this.cltr->idles.total -= 1u;
     513        unlock( this.cltr->idles );
     514
    508515        // Lock the RWlock so no-one pushes/pops while we are changing the queue
    509516        uint_fast32_t last_size = ready_mutate_lock();
    510                 this.cltr->procs.total -= 1u;
    511                 remove(this);
    512517
    513518                // Adjust the ready queue size
    514                 ready_queue_shrink( this.cltr );
    515 
    516         // Unlock the RWlock and unregister: we don't need the read_lock any more
    517         ready_mutate_unregister((__processor_id_t*)&this, last_size );
     519                ready_queue_shrink( this.cltr, target );
     520
     521        // Unlock the RWlock
     522        ready_mutate_unlock( last_size );
     523
     524        // Finally we don't need the read_lock any more
     525        unregister((__processor_id_t*)&this);
    518526
    519527        close(this.idle);
     
    558566//-----------------------------------------------------------------------------
    559567// Cluster
    560 static void ?{}(__cluster_proc_list & this) {
     568static void ?{}(__cluster_idles & this) {
    561569        this.lock  = 0;
    562570        this.idle  = 0;
    563571        this.total = 0;
     572        (this.list){};
    564573}
    565574
     
    587596
    588597                // Adjust the ready queue size
    589                 ready_queue_grow( &this );
     598                ready_queue_grow( &this, 0 );
    590599
    591600        // Unlock the RWlock
     
    602611
    603612                // Adjust the ready queue size
    604                 ready_queue_shrink( &this );
     613                ready_queue_shrink( &this, 0 );
    605614
    606615        // Unlock the RWlock
Note: See TracChangeset for help on using the changeset viewer.