Changeset be5f0a5 for libcfa/src


Ignore:
Timestamp:
Oct 28, 2022, 5:22:32 PM (18 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, master
Children:
15c93d8
Parents:
13edbac
Message:

Changed monitors to use the user_link instead of the ready_link

Location:
libcfa/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/bits/containers.hfa

    r13edbac rbe5f0a5  
    152152
    153153                void append( __queue(T) & this, T * val ) with(this) {
     154                        verify(get_next( *val ) == 0p);
    154155                        verify(this.tail != 0p);
    155156                        verify(*this.tail == 1p);
  • libcfa/src/concurrency/invoke.h

    r13edbac rbe5f0a5  
    232232
    233233                static inline thread$ *& get_next( thread$ & this ) __attribute__((const)) {
    234                         return this.link.next;
     234                        return this.user_link.next;
    235235                }
    236236
  • libcfa/src/concurrency/monitor.cfa

    r13edbac rbe5f0a5  
    122122
    123123                // Some one else has the monitor, wait in line for it
    124                 /* paranoid */ verify( thrd->link.next == 0p );
     124                /* paranoid */ verify( thrd->user_link.next == 0p );
    125125                append( this->entry_queue, thrd );
    126                 /* paranoid */ verify( thrd->link.next == 1p );
     126                /* paranoid */ verify( thrd->user_link.next == 1p );
    127127
    128128                unlock( this->lock );
     
    233233
    234234                // Some one else has the monitor, wait in line for it
    235                 /* paranoid */ verify( thrd->link.next == 0p );
     235                /* paranoid */ verify( thrd->user_link.next == 0p );
    236236                append( this->entry_queue, thrd );
    237                 /* paranoid */ verify( thrd->link.next == 1p );
     237                /* paranoid */ verify( thrd->user_link.next == 1p );
    238238                unlock( this->lock );
    239239
     
    791791        thread$ * new_owner = pop_head( this->entry_queue );
    792792        /* paranoid */ verifyf( !this->owner || active_thread() == this->owner, "Expected owner to be %p, got %p (r: %i, m: %p)", active_thread(), this->owner, this->recursion, this );
    793         /* paranoid */ verify( !new_owner || new_owner->link.next == 0p );
     793        /* paranoid */ verify( !new_owner || new_owner->user_link.next == 0p );
    794794        __set_owner( this, new_owner );
    795795
     
    935935        __queue_t(thread$) & entry_queue = monitors[0]->entry_queue;
    936936
     937        #if defined( __CFA_WITH_VERIFY__ )
     938                thread$ * last = 0p;
     939        #endif
    937940        // For each thread in the entry-queue
    938941        for(    thread$ ** thrd_it = &entry_queue.head;
    939942                (*thrd_it) != 1p;
    940                 thrd_it = &(*thrd_it)->link.next
     943                thrd_it = &get_next(**thrd_it)
    941944        ) {
     945                thread$ * curr = *thrd_it;
     946
     947                /* paranoid */ verifyf( !last || last->user_link.next == curr, "search not making progress, from %p (%p) to %p", last, last->user_link.next, curr );
     948                /* paranoid */ verifyf( curr != last, "search not making progress, from %p to %p", last, curr );
     949
    942950                // For each acceptable check if it matches
    943951                int i = 0;
     
    946954                for( __acceptable_t * it = begin; it != end; it++, i++ ) {
    947955                        // Check if we have a match
    948                         if( *it == (*thrd_it)->monitors ) {
     956                        if( *it == curr->monitors ) {
    949957
    950958                                // If we have a match return it
     
    953961                        }
    954962                }
     963
     964                #if defined( __CFA_WITH_VERIFY__ )
     965                        last = curr;
     966                #endif
    955967        }
    956968
     
    10251037
    10261038                // Some one else has the monitor, wait in line for it
    1027                 /* paranoid */ verify( thrd->link.next == 0p );
     1039                /* paranoid */ verify( thrd->user_link.next == 0p );
    10281040                append( this->entry_queue, thrd );
    1029                 /* paranoid */ verify( thrd->link.next == 1p );
     1041                /* paranoid */ verify( thrd->user_link.next == 1p );
    10301042
    10311043                unlock( this->lock );
Note: See TracChangeset for help on using the changeset viewer.