Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/monitor.hfa

    r58b6d1b rac2b598  
    1010// Created On       : Thd Feb 23 12:27:26 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Oct  7 18:06:45 2017
    13 // Update Count     : 10
     12// Last Modified On : Wed Dec  4 07:55:32 2019
     13// Update Count     : 11
    1414//
    1515
     
    2323
    2424trait is_monitor(dtype T) {
    25         monitor_desc * get_monitor( T & );
     25        $monitor * get_monitor( T & );
    2626        void ^?{}( T & mutex );
    2727};
    2828
    29 static inline void ?{}(monitor_desc & this) with( this ) {
     29static inline void ?{}($monitor & this) with( this ) {
    3030        lock{};
    3131        entry_queue{};
    3232        signal_stack{};
    33         owner         = NULL;
     33        owner         = 0p;
    3434        recursion     = 0;
    35         mask.accepted = NULL;
    36         mask.data     = NULL;
     35        mask.accepted = 0p;
     36        mask.data     = 0p;
    3737        mask.size     = 0;
    38         dtor_node     = NULL;
     38        dtor_node     = 0p;
    3939}
    4040
     41static inline void ^?{}($monitor & ) {}
     42
    4143struct monitor_guard_t {
    42         monitor_desc **         m;
     44        $monitor **     m;
    4345        __lock_size_t           count;
    4446        __monitor_group_t prev;
    4547};
    4648
    47 void ?{}( monitor_guard_t & this, monitor_desc ** m, __lock_size_t count, void (*func)() );
     49void ?{}( monitor_guard_t & this, $monitor ** m, __lock_size_t count, void (*func)() );
    4850void ^?{}( monitor_guard_t & this );
    4951
    5052struct monitor_dtor_guard_t {
    51         monitor_desc *    m;
     53        $monitor *    m;
    5254        __monitor_group_t prev;
    5355};
    5456
    55 void ?{}( monitor_dtor_guard_t & this, monitor_desc ** m, void (*func)() );
     57void ?{}( monitor_dtor_guard_t & this, $monitor ** m, void (*func)() );
    5658void ^?{}( monitor_dtor_guard_t & this );
    5759
     
    7072
    7173        // The monitor this criterion concerns
    72         monitor_desc * target;
     74        $monitor * target;
    7375
    7476        // The parent node to which this criterion belongs
     
    8587struct __condition_node_t {
    8688        // Thread that needs to be woken when all criteria are met
    87         thread_desc * waiting_thread;
     89        $thread * waiting_thread;
    8890
    8991        // Array of criteria (Criterions are contiguous in memory)
     
    104106}
    105107
    106 void ?{}(__condition_node_t & this, thread_desc * waiting_thread, __lock_size_t count, uintptr_t user_info );
     108void ?{}(__condition_node_t & this, $thread * waiting_thread, __lock_size_t count, uintptr_t user_info );
    107109void ?{}(__condition_criterion_t & this );
    108 void ?{}(__condition_criterion_t & this, monitor_desc * target, __condition_node_t * owner );
     110void ?{}(__condition_criterion_t & this, $monitor * target, __condition_node_t * owner );
    109111
    110112struct condition {
     
    113115
    114116        // Array of monitor pointers (Monitors are NOT contiguous in memory)
    115         monitor_desc ** monitors;
     117        $monitor ** monitors;
    116118
    117119        // Number of monitors in the array
     
    120122
    121123static inline void ?{}( condition & this ) {
    122         this.monitors = NULL;
     124        this.monitors = 0p;
    123125        this.monitor_count = 0;
    124126}
     
    131133              bool signal      ( condition & this );
    132134              bool signal_block( condition & this );
    133 static inline bool is_empty    ( condition & this ) { return !this.blocked.head; }
     135static inline bool is_empty    ( condition & this ) { return this.blocked.head == 1p; }
    134136         uintptr_t front       ( condition & this );
    135137
Note: See TracChangeset for help on using the changeset viewer.