Ignore:
Timestamp:
Nov 8, 2021, 5:28:21 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum, stuck-waitfor-destruct
Children:
36a05d7
Parents:
949339b (diff), 5ee153d (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

Location:
libcfa/src/concurrency
Files:
6 edited

Legend:

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

    r949339b rcc287800  
    183183                ctx.proc->io.pending = false;
    184184
    185                 ready_schedule_lock();
    186185                __cfa_io_drain( proc );
    187                 ready_schedule_unlock();
    188186                // for(i; 2) {
    189187                //      unsigned idx = proc->rdq.id + i;
     
    311309                // Make the sqes visible to the submitter
    312310                __atomic_store_n(sq.kring.tail, tail + have, __ATOMIC_RELEASE);
    313                 sq.to_submit++;
     311                sq.to_submit += have;
    314312
    315313                ctx->proc->io.pending = true;
    316314                ctx->proc->io.dirty   = true;
    317315                if(sq.to_submit > 30 || !lazy) {
     316                        ready_schedule_lock();
    318317                        __cfa_io_flush( ctx->proc );
     318                        ready_schedule_unlock();
    319319                }
    320320        }
  • libcfa/src/concurrency/io/types.hfa

    r949339b rcc287800  
    188188                return wait(this.self);
    189189        }
     190
     191        void reset( io_future_t & this ) {
     192                return reset(this.self);
     193        }
    190194}
  • libcfa/src/concurrency/kernel.cfa

    r949339b rcc287800  
    196196
    197197                        if( !readyThread ) {
     198                                ready_schedule_lock();
    198199                                __cfa_io_flush( this );
     200                                ready_schedule_unlock();
     201
    199202                                readyThread = __next_thread_slow( this->cltr );
    200203                        }
     
    277280
    278281                        if(this->io.pending && !this->io.dirty) {
     282                                ready_schedule_lock();
    279283                                __cfa_io_flush( this );
     284                                ready_schedule_unlock();
    280285                        }
    281286
     
    317322
    318323                                // Don't block if we are done
    319                                 if( __atomic_load_n(&this->do_terminate, __ATOMIC_SEQ_CST) ) break MAIN_LOOP;
     324                                if( __atomic_load_n(&this->do_terminate, __ATOMIC_SEQ_CST) ) {
     325                                        ready_schedule_unlock();
     326                                        break MAIN_LOOP;
     327                                }
    320328
    321329                                __STATS( __tls_stats()->ready.sleep.halts++; )
     
    939947                        /* paranoid */ verifyf( it, "Unexpected null iterator, at index %u of %u\n", i, count);
    940948                        /* paranoid */ verify( it->local_data->this_stats );
     949                        // __print_stats( it->local_data->this_stats, cltr->print_stats, "Processor", it->name, (void*)it );
    941950                        __tally_stats( cltr->stats, it->local_data->this_stats );
    942951                        it = &(*it)`next;
     
    948957                // this doesn't solve all problems but does solve many
    949958                // so it's probably good enough
     959                disable_interrupts();
    950960                uint_fast32_t last_size = ready_mutate_lock();
    951961
     
    955965                // Unlock the RWlock
    956966                ready_mutate_unlock( last_size );
     967                enable_interrupts();
    957968        }
    958969
  • libcfa/src/concurrency/kernel/startup.cfa

    r949339b rcc287800  
    100100// Other Forward Declarations
    101101extern void __wake_proc(processor *);
     102extern int cfa_main_returned;                                                   // from interpose.cfa
    102103
    103104//-----------------------------------------------------------------------------
     
    268269
    269270static void __kernel_shutdown(void) {
     271        if(!cfa_main_returned) return;
    270272        /* paranoid */ verify( __preemption_enabled() );
    271273        disable_interrupts();
  • libcfa/src/concurrency/monitor.hfa

    r949339b rcc287800  
    6565        free( th );
    6666}
     67
     68static inline forall( T & | sized(T) | { void ^?{}( T & mutex ); } )
     69void adelete( T arr[] ) {
     70        if ( arr ) {                                                                            // ignore null
     71                size_t dim = malloc_size( arr ) / sizeof( T );
     72                for ( int i = dim - 1; i >= 0; i -= 1 ) {               // reverse allocation order, must be unsigned
     73                        ^(arr[i]){};                                                            // run destructor
     74                } // for
     75                free( arr );
     76        } // if
     77} // adelete
    6778
    6879//-----------------------------------------------------------------------------
  • libcfa/src/concurrency/mutex_stmt.hfa

    r949339b rcc287800  
    11#include "bits/algorithm.hfa"
    2 #include <assert.h>
    3 #include "invoke.h"
    4 #include "stdlib.hfa"
    5 #include <stdio.h>
     2#include "bits/defs.hfa"
    63
    74//-----------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.