Changeset afd7faf


Ignore:
Timestamp:
May 17, 2021, 9:20:55 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
d7ae173
Parents:
d2afe17
Message:

Small fixes to lock and alarm around possible race and the thunk problem.

Location:
libcfa/src/concurrency
Files:
2 edited

Legend:

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

    rd2afe17 rafd7faf  
    118118                insert( &alarms, this );
    119119                __kernel_set_timer( this->initial );
     120                this->set = true;
    120121        }
    121122        unlock( event_kernel->lock );
    122         this->set = true;
    123123        enable_interrupts();
    124124}
     
    129129        {
    130130                verify( validate( event_kernel->alarms ) );
    131                 remove( *this );
     131                if (this->set) remove( *this );
     132                this->set = false;
    132133        }
    133134        unlock( event_kernel->lock );
    134135        enable_interrupts();
    135         this->set = false;
    136136}
    137137
  • libcfa/src/concurrency/locks.cfa

    rd2afe17 rafd7faf  
    313313
    314314        // helper for wait()'s' with a timeout
    315         void queue_info_thread_timeout( condition_variable(L) & this, info_thread(L) & info, Duration t ) with(this) {
     315        void queue_info_thread_timeout( condition_variable(L) & this, info_thread(L) & info, Duration t, Alarm_Callback callback ) with(this) {
    316316                lock( lock __cfaabi_dbg_ctx2 );
    317317                size_t recursion_count = queue_and_get_recursion(this, &info);
    318                 alarm_node_wrap(L) node_wrap = { t, 0`s, alarm_node_wrap_cast, &this, &info };
     318                alarm_node_wrap(L) node_wrap = { t, 0`s, callback, &this, &info };
    319319                register_self( &node_wrap.alarm_node );
    320320                unlock( lock );
     
    332332        #define WAIT_TIME( u, l, t ) \
    333333                info_thread( L ) i = { active_thread(), u, l }; \
    334                 queue_info_thread_timeout(this, i, t ); \
     334                queue_info_thread_timeout(this, i, t, alarm_node_wrap_cast ); \
    335335                return i.signalled;
    336336
Note: See TracChangeset for help on using the changeset viewer.