Changes in / [1eb222ff:02a43ff]


Ignore:
Files:
2 added
4 edited

Legend:

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

    r1eb222ff r02a43ff  
    119119                insert( &alarms, this );
    120120                __kernel_set_timer( this->timeval - curr);
     121                this->set = true;
    121122        }
    122123        unlock( event_kernel->lock );
    123         this->set = true;
    124124        enable_interrupts();
    125125}
     
    130130        {
    131131                verify( validate( event_kernel->alarms ) );
    132                 remove( *this );
     132                if (this->set) remove( *this );
     133                this->set = false;
    133134        }
    134135        unlock( event_kernel->lock );
    135136        enable_interrupts();
    136         this->set = false;
    137137}
    138138
  • libcfa/src/concurrency/locks.cfa

    r1eb222ff r02a43ff  
    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
  • src/GenPoly/Box.cc

    r1eb222ff r02a43ff  
    15251525                                        stmtsToAddBefore.push_back( new DeclStmt( newBuf ) );
    15261526
     1527                                        // if the object has a cleanup attribute, the cleanup should be on the buffer, not the pointer
     1528                                        auto matchAndMove = [newBuf](Attribute * attr){
     1529                                                if(attr->name == "cleanup") {
     1530                                                        newBuf->attributes.push_back(attr);
     1531                                                        return true;
     1532                                                }
     1533                                                return false;
     1534                                        };
     1535
     1536                                        objectDecl->attributes.remove_if(matchAndMove);
     1537
    15271538                                        delete objectDecl->get_init();
    15281539                                        objectDecl->set_init( new SingleInit( new VariableExpr( newBuf ) ) );
  • tests/unified_locking/timeout_lock.cfa

    r1eb222ff r02a43ff  
    3333
    3434        for ( unsigned int i = 0; i < NoOfTimes + 3; i += 1 ) {
    35             if ( wait( c_m, m, 1`s ) ) { 
     35            if ( wait( c_m, m, 1`s ) ) {
    3636                        // printf("Thread: %p signalled\n", active_thread()); // removed since can't expect non deterministic output
    3737            } else {
     
    7373        processor p[2];
    7474        printf("Start Test 1: surface testing condition variable timeout routines\n");
    75         wait( c_m, 1`ns );                                                                                                              // bool wait( condition_variable(L) & this, Duration duration );       
     75        wait( c_m, 1`ns );                                                                                                              // bool wait( condition_variable(L) & this, Duration duration );
    7676        wait( c_m, 10, 1`ns );                                                                                                  // bool wait( condition_variable(L) & this, uintptr_t info, Duration duration );
    77         wait( c_m, __kernel_get_time() + 1`ns );                                                                // bool wait( condition_variable(L) & this, Time time );
    78         wait( c_m, 10, __kernel_get_time() + 1`ns );                                                    // bool wait( condition_variable(L) & this, uintptr_t info, Time time );
    7977        lock(m); wait( c_m, m, 1`ns ); unlock(m);                                                               // bool wait( condition_variable(L) & this, L & l, Duration duration );
    8078        lock(m); wait( c_m, m, 10, 1`ns ); unlock(m);                                                   // bool wait( condition_variable(L) & this, L & l, uintptr_t info, Duration duration );
    81         lock(m); wait( c_m, m, __kernel_get_time() + 1`ns ); unlock(m);                 // bool wait( condition_variable(L) & this, L & l, Time time );
    82         lock(m); wait( c_m, m, 10, __kernel_get_time() + 1`ns ); unlock(m);             // bool wait( condition_variable(L) & this, L & l, uintptr_t info, Time time );
    8379        printf("Done Test 1\n");
    8480
Note: See TracChangeset for help on using the changeset viewer.