Changeset aaa4f93 for src/libcfa


Ignore:
Timestamp:
Sep 21, 2017, 11:33:23 AM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
7453a68
Parents:
a2dbad10
Message:

Updated accepted index to live in the waitfor caller stack.
Waitfor no longer blocks if all when clauses are false.
Waitfor now properly zeroes out acceptables before use.

Location:
src/libcfa/concurrency
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/monitor

    ra2dbad10 raaa4f93  
    105105
    106106struct __acceptable_t {
    107         __monitor_group_t monitors;
     107        __monitor_group_t;
    108108        bool is_dtor;
    109109};
  • src/libcfa/concurrency/monitor.c

    ra2dbad10 raaa4f93  
    280280        lock_all( monitors, locks, count );
    281281
    282         // DON'T unlock, ask the kernel to do it
    283 
    284         // Save monitor state
    285         save_recursion( monitors, recursions, count );
    286 
    287282        // Find the next thread(s) to run
    288283        unsigned short thread_count = 0;
     
    297292                thread_count = insert_unique( threads, thread_count, new_owner );
    298293        }
     294
     295        // Save monitor state
     296        save_recursion( monitors, recursions, count );
    299297
    300298        // Everything is ready to go to sleep
     
    634632        // For all acceptable functions check if this is the current function.
    635633        for( short i = 0; i < count; i++, it++ ) {
    636                 if( it->monitors == group ) {
     634                if( *it == group ) {
    637635                        *this->mask.accepted = i;
    638636                        return true;
     
    658656                for( __acceptable_t * it = mask.clauses; it != end; it++, i++ ) {
    659657                        // Check if we have a match
    660                         if( it->monitors == (*thrd_it)->monitors ) {
     658                        if( *it == (*thrd_it)->monitors ) {
    661659
    662660                                // If we have a match return it
     
    673671        short max = 0;
    674672        for( int i = 0; i < mask.size; i++ ) {
    675                 max += mask.clauses[i].monitors.size;
     673                max += mask.clauses[i].size;
    676674        }
    677675        return max;
Note: See TracChangeset for help on using the changeset viewer.