Ignore:
File:
1 edited

Legend:

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

    rdff1fd1 rd25b2d6  
    1717                this.t = t;
    1818                this.lock = 0p;
     19                this.listed = false;
    1920        }
    2021
     
    2425                this.info = info;
    2526                this.lock = 0p;
     27                this.listed = false;
    2628        }
    2729
     
    3436        info_thread(L) *& Next( info_thread(L) * this ) {
    3537                return (info_thread(L) *)Next( (Colable *)this );
     38        }
     39
     40        bool listed( info_thread(L) * this ) {
     41                return Next( (Colable *)this ) != 0p;
    3642        }
    3743}
     
    188194        // This condition_variable member is called from the kernel, and therefore, cannot block, but it can spin.
    189195            lock( cond->lock __cfaabi_dbg_ctx2 );
    190             if ( listed(i) ) {                  // is thread on queue
    191                 i->signalled = false;
     196           
     197            if ( i->listed ) {                  // is thread on queue
    192198                cond->last_thread = i;          // REMOVE THIS AFTER DEBUG
    193199                        remove( cond->blocked_threads, *i );             //remove this thread O(1)
     
    221227        void process_popped( condition_variable(L) & this, info_thread(L) & popped ) with( this ) {
    222228                if(&popped != 0p) {
    223                         popped.signalled = true;
     229                        popped.listed = false;
    224230                        count--;
    225231                        if (popped.lock) {
     
    260266                addTail( blocked_threads, *i );
    261267                count++;
     268                i->listed = true;
    262269                size_t recursion_count = 0;
    263270                if (i->lock) {
     
    301308        }
    302309       
    303         bool wait( condition_variable(L) & this, Duration duration ) with(this) {
     310        void wait( condition_variable(L) & this, Duration duration ) with(this) {
    304311                info_thread( L ) i = { active_thread() };
    305312                queue_info_thread_timeout(this, i, __kernel_get_time() + duration );
    306                 return i.signalled;
    307         }
    308 
    309         bool wait( condition_variable(L) & this, uintptr_t info, Duration duration ) with(this) {
     313        }
     314
     315        void wait( condition_variable(L) & this, uintptr_t info, Duration duration ) with(this) {
    310316                info_thread( L ) i = { active_thread(), info };
    311317                queue_info_thread_timeout(this, i, __kernel_get_time() + duration );
    312                 return i.signalled;
    313         }
    314 
    315         bool wait( condition_variable(L) & this, Time time ) with(this) {
     318        }
     319
     320        void wait( condition_variable(L) & this, Time time ) with(this) {
    316321                info_thread( L ) i = { active_thread() };
    317322                queue_info_thread_timeout(this, i, time);
    318                 return i.signalled;
    319         }
    320 
    321         bool wait( condition_variable(L) & this, uintptr_t info, Time time ) with(this) {
     323        }
     324
     325        void wait( condition_variable(L) & this, uintptr_t info, Time time ) with(this) {
    322326                info_thread( L ) i = { active_thread(), info };
    323327                queue_info_thread_timeout(this, i, time);
    324                 return i.signalled;
    325328        }
    326329
     
    337340        }
    338341       
    339         bool wait( condition_variable(L) & this, L & l, Duration duration ) with(this) {
     342        void wait( condition_variable(L) & this, L & l, Duration duration ) with(this) {
    340343                info_thread(L) i = { active_thread() };
    341344                i.lock = &l;
    342345                queue_info_thread_timeout(this, i, __kernel_get_time() + duration );
    343                 return i.signalled;
    344         }
    345        
    346         bool wait( condition_variable(L) & this, L & l, uintptr_t info, Duration duration ) with(this) {
     346        }
     347       
     348        void wait( condition_variable(L) & this, L & l, uintptr_t info, Duration duration ) with(this) {
    347349                info_thread(L) i = { active_thread(), info };
    348350                i.lock = &l;
    349351                queue_info_thread_timeout(this, i, __kernel_get_time() + duration );
    350                 return i.signalled;
    351         }
    352        
    353         bool wait( condition_variable(L) & this, L & l, Time time ) with(this) {
     352        }
     353       
     354        void wait( condition_variable(L) & this, L & l, Time time ) with(this) {
    354355                info_thread(L) i = { active_thread() };
    355356                i.lock = &l;
    356357                queue_info_thread_timeout(this, i, time );
    357                 return i.signalled;
    358         }
    359        
    360         bool wait( condition_variable(L) & this, L & l, uintptr_t info, Time time ) with(this) {
     358        }
     359       
     360        void wait( condition_variable(L) & this, L & l, uintptr_t info, Time time ) with(this) {
    361361                info_thread(L) i = { active_thread(), info };
    362362                i.lock = &l;
    363363                queue_info_thread_timeout(this, i, time );
    364                 return i.signalled;
    365         }
    366 }
     364        }
     365}
Note: See TracChangeset for help on using the changeset viewer.