Ignore:
File:
1 edited

Legend:

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

    r431cd4f ra5a01faa  
    268268                        __print_stats( st, mainProcessor->print_stats, "Processor ", mainProcessor->name, (void*)mainProcessor );
    269269                }
    270                 #if defined(CFA_STATS_ARRAY)
    271                         __flush_stat( st, "Processor", mainProcessor );
    272                 #endif
    273270        #endif
    274271
     
    351348                        __print_stats( &local_stats, proc->print_stats, "Processor ", proc->name, (void*)proc );
    352349                }
    353                 #if defined(CFA_STATS_ARRAY)
    354                         __flush_stat( &local_stats, "Processor", proc );
    355                 #endif
    356350        #endif
    357351
     
    469463        this.name = name;
    470464        this.cltr = &_cltr;
    471         this.rdq.its = 0;
    472         this.rdq.itr = 0;
    473         this.rdq.id  = -1u;
    474         this.rdq.target = -1u;
    475         this.rdq.cutoff = -1ull;
    476465        do_terminate = false;
    477466        preemption_alarm = 0p;
     
    494483        #endif
    495484
    496         // Register and Lock the RWlock so no-one pushes/pops while we are changing the queue
    497         uint_fast32_t last_size = ready_mutate_register((__processor_id_t*)&this);
    498                 this.cltr->procs.total += 1u;
    499                 insert_last(this.cltr->procs.actives, this);
     485        lock( this.cltr->idles );
     486                int target = this.cltr->idles.total += 1u;
     487        unlock( this.cltr->idles );
     488
     489        id = doregister((__processor_id_t*)&this);
     490
     491        // Lock the RWlock so no-one pushes/pops while we are changing the queue
     492        uint_fast32_t last_size = ready_mutate_lock();
    500493
    501494                // Adjust the ready queue size
    502                 ready_queue_grow( cltr );
     495                this.cltr_id = ready_queue_grow( cltr, target );
    503496
    504497        // Unlock the RWlock
     
    510503// Not a ctor, it just preps the destruction but should not destroy members
    511504static void deinit(processor & this) {
     505        lock( this.cltr->idles );
     506                int target = this.cltr->idles.total -= 1u;
     507        unlock( this.cltr->idles );
     508
    512509        // Lock the RWlock so no-one pushes/pops while we are changing the queue
    513510        uint_fast32_t last_size = ready_mutate_lock();
    514                 this.cltr->procs.total -= 1u;
    515                 remove(this);
    516511
    517512                // Adjust the ready queue size
    518                 ready_queue_shrink( this.cltr );
    519 
    520         // Unlock the RWlock and unregister: we don't need the read_lock any more
    521         ready_mutate_unregister((__processor_id_t*)&this, last_size );
     513                ready_queue_shrink( this.cltr, target );
     514
     515        // Unlock the RWlock
     516        ready_mutate_unlock( last_size );
     517
     518        // Finally we don't need the read_lock any more
     519        unregister((__processor_id_t*)&this);
    522520
    523521        close(this.idle);
     
    562560//-----------------------------------------------------------------------------
    563561// Cluster
    564 static void ?{}(__cluster_proc_list & this) {
     562static void ?{}(__cluster_idles & this) {
    565563        this.lock  = 0;
    566564        this.idle  = 0;
    567565        this.total = 0;
     566        (this.list){};
    568567}
    569568
     
    591590
    592591                // Adjust the ready queue size
    593                 ready_queue_grow( &this );
     592                ready_queue_grow( &this, 0 );
    594593
    595594        // Unlock the RWlock
     
    606605
    607606                // Adjust the ready queue size
    608                 ready_queue_shrink( &this );
     607                ready_queue_shrink( &this, 0 );
    609608
    610609        // Unlock the RWlock
     
    616615                        __print_stats( this.stats, this.print_stats, "Cluster", this.name, (void*)&this );
    617616                }
    618                 #if defined(CFA_STATS_ARRAY)
    619                         __flush_stat( this.stats, "Cluster", &this );
    620                 #endif
    621617                free( this.stats );
    622618        #endif
Note: See TracChangeset for help on using the changeset viewer.