Ignore:
Timestamp:
Mar 16, 2017, 5:20:16 PM (8 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:
3743983
Parents:
1fbab5a
Message:

Implemented monitor keyword, and it works

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/monitor.c

    r1fbab5a ref42b143  
    1313}
    1414
     15monitor_desc * get_monitor( global_t * this ) {
     16        return &this->m;
     17}
     18
    1519static global_t global;
    1620
    17 void increment( /*mutex*/ global_t * this ) {
    18         monitor_desc * mon = &this->m;
    19         monitor_guard_t g1 = { &mon };
    20         {
    21                 monitor_guard_t g2 = { &mon };
    22                 {
    23                         monitor_guard_t g3 = { &mon };
    24                         this->value += 1;
    25                 }
    26         }
     21void increment3( global_t * mutex this ) {
     22        this->value += 1;
     23}
     24
     25void increment2( global_t * mutex this ) {
     26        increment3( this );
     27}
     28
     29void increment( global_t * mutex this ) {
     30        increment2( this );
    2731}
    2832
Note: See TracChangeset for help on using the changeset viewer.