Ignore:
Timestamp:
Mar 3, 2017, 10:12:10 PM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
c443d1d, d107010
Parents:
dd020c0 (diff), bf8da66 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg2:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/monitor

    rdd020c0 r8191203  
    2020#include "assert"
    2121#include "invoke.h"
     22#include "stdlib"
    2223
    2324struct __monitor_t {
     
    3334}
    3435
     36//Basic entering routine
    3537void enter(__monitor_t *);
    3638void leave(__monitor_t *);
    3739
     40//Array entering routine
     41void enter(__monitor_t **, int count);
     42void leave(__monitor_t **, int count);
     43
    3844struct monitor_guard_t {
    39         __monitor_t * m;
     45        __monitor_t ** m;
     46        int count;
    4047};
    4148
    42 static inline void ?{}( monitor_guard_t * this, __monitor_t * m ) {
     49static inline int ?<?(__monitor_t* lhs, __monitor_t* rhs) {
     50        return ((intptr_t)lhs) < ((intptr_t)rhs);
     51}
     52
     53static inline void ?{}( monitor_guard_t * this, __monitor_t ** m ) {
    4354        this->m = m;
    44         enter( this->m );
     55        this->count = 1;
     56        enter( *this->m );
     57}
     58
     59static inline void ?{}( monitor_guard_t * this, __monitor_t ** m, int count ) {
     60        this->m = m;
     61        this->count = count;
     62        qsort(this->m, count);
     63        enter( this->m, this->count );
    4564}
    4665
    4766static inline void ^?{}( monitor_guard_t * this ) {
    48         leave( this->m );
     67        leave( this->m, this->count );
    4968}
    5069
     70
    5171#endif //MONITOR_H
Note: See TracChangeset for help on using the changeset viewer.