Changes in / [24cde55:6ce9f7c7]


Ignore:
Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/monitor

    r24cde55 r6ce9f7c7  
    3030void leave(monitor *);
    3131
     32struct monitor_guard {
     33        monitor * m;
     34};
     35
     36static inline void ?{}( monitor_guard * this, monitor * m ) {
     37        this->m = m;
     38        enter( this->m );
     39}
     40
     41static inline void ^?{}( monitor_guard * this ) {
     42        leave( this->m );
     43}
     44
    3245#endif //MONITOR_H
  • src/libcfa/concurrency/monitor.c

    r24cde55 r6ce9f7c7  
    4444
    4545        unlock( &this->lock );
     46
    4647        if( this->holder ) ScheduleThread( this->holder );
    4748}
  • src/tests/monitor.c

    r24cde55 r6ce9f7c7  
    1616
    1717void increment( /*mutex*/ global_t * this ) {
    18         enter( &this->m );
     18        monitor_guard g = { &this->m };
    1919        this->value += 1;
    20         leave( &this->m );
    2120}
    2221
Note: See TracChangeset for help on using the changeset viewer.