Ignore:
File:
1 edited

Legend:

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

    r1cd2839 red52dd5  
    1010// Created On       : Thd Feb 23 12:27:26 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Nov 21 08:31:55 2024
    13 // Update Count     : 18
     12// Last Modified On : Sun Feb 19 17:00:59 2023
     13// Update Count     : 12
    1414//
    1515
     
    931931
    932932static inline [thread$ *, int] search_entry_queue( const __waitfor_mask_t & mask, monitor$ * monitors [], __lock_size_t count ) {
     933
    933934        __queue_t(thread$) & entry_queue = monitors[0]->entry_queue;
    934935
    935 #if 0
    936936        #if defined( __CFA_WITH_VERIFY__ )
    937937                thread$ * last = 0p;
    938938        #endif
    939939        // For each thread in the entry-queue
    940         for ( thread$ ** thrd_it = &entry_queue.head; (*thrd_it) != 1p; thrd_it = &get_next(**thrd_it) ) {
     940        for(    thread$ ** thrd_it = &entry_queue.head;
     941                (*thrd_it) != 1p;
     942                thrd_it = &get_next(**thrd_it)
     943        ) {
    941944                thread$ * curr = *thrd_it;
    942945
    943                 /* paranoid */ verifyf( !last || last->user_link.next == curr, "search not making progress, from %p (%p) to %p",
    944                                                                 last, last->user_link.next, curr );
     946                /* paranoid */ verifyf( !last || last->user_link.next == curr, "search not making progress, from %p (%p) to %p", last, last->user_link.next, curr );
    945947                /* paranoid */ verifyf( curr != last, "search not making progress, from %p to %p", last, curr );
    946948
     
    949951                __acceptable_t * end   = end  (mask);
    950952                __acceptable_t * begin = begin(mask);
    951                 for ( __acceptable_t * it = begin; it != end; it++, i++ ) {
    952                         // Check for match
    953                         if ( *it == curr->monitors ) {
    954                                 // If match, return it after removeing it from the entry queue
     953                for( __acceptable_t * it = begin; it != end; it++, i++ ) {
     954                        // Check if we have a match
     955                        if( *it == curr->monitors ) {
     956
     957                                // If we have a match return it
     958                                // after removeing it from the entry queue
    955959                                return [remove( entry_queue, thrd_it ), i];
    956960                        }
     
    961965                #endif
    962966        }
    963 #endif
    964         int i = 0;
    965         __acceptable_t * end   = end  (mask);
    966         __acceptable_t * begin = begin(mask);
    967         // For each acceptable (respect lexical priority in waitfor statement)
    968         for ( __acceptable_t * it = begin; it != end; it++, i++ ) {
    969                 #if defined( __CFA_WITH_VERIFY__ )
    970                 thread$ * last = 0p;
    971                 #endif // __CFA_WITH_VERIFY__
    972 
    973                 for ( thread$ ** thrd_it = &entry_queue.head; (*thrd_it) != 1p; thrd_it = &get_next(**thrd_it) ) {
    974                         thread$ * curr = *thrd_it;
    975 
    976                         /* paranoid */ verifyf( !last || last->user_link.next == curr, "search not making progress, from %p (%p) to %p",
    977                                                                         last, last->user_link.next, curr );
    978                         /* paranoid */ verifyf( curr != last, "search not making progress, from %p to %p", last, curr );
    979 
    980                         // For each thread in the entry-queue check for a match
    981                         if ( *it == curr->monitors ) {
    982                                 // If match, return it after removeing from the entry queue
    983                                 return [remove( entry_queue, thrd_it ), i];
    984                         } // if
    985 
    986                         #if defined( __CFA_WITH_VERIFY__ )
    987                         last = curr;
    988                         #endif
    989                 } // for
    990         } // for
     967
    991968        return [0, -1];
    992969}
Note: See TracChangeset for help on using the changeset viewer.