Ignore:
Timestamp:
Feb 28, 2017, 12:40:47 PM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
2781e65, fd061ed3
Parents:
4868be4
Message:
  • renamed monitor to monitor_t since the type should not be exposed to users
  • added support for recursion in monitors
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/monitor

    r4868be4 rcc7f4b1  
    2121#include "invoke.h"
    2222
    23 struct monitor {
     23struct __monitor_t {
    2424        spinlock lock;
    25         thread * holder;
     25        thread * owner;
    2626        simple_thread_list entry_queue;
     27        unsigned int recursion;
    2728};
    2829
    29 void enter(monitor *);
    30 void leave(monitor *);
     30static inline void ?{}(__monitor_t * this) {
     31        this->owner = 0;
     32        this->recursion = 0;
     33}
    3134
    32 struct monitor_guard {
    33         monitor * m;
     35void enter(__monitor_t *);
     36void leave(__monitor_t *);
     37
     38struct monitor_guard_t {
     39        __monitor_t * m;
    3440};
    3541
    36 static inline void ?{}( monitor_guard * this, monitor * m ) {
     42static inline void ?{}( monitor_guard_t * this, __monitor_t * m ) {
    3743        this->m = m;
    3844        enter( this->m );
    3945}
    4046
    41 static inline void ^?{}( monitor_guard * this ) {
     47static inline void ^?{}( monitor_guard_t * this ) {
    4248        leave( this->m );
    4349}
Note: See TracChangeset for help on using the changeset viewer.