ADT
        aaron-thesis
        arm-eh
        ast-experimental
        cleanup-dtors
        deferred_resn
        demangler
        enum
        forall-pointer-decay
        jacob/cs343-translation
        jenkins-sandbox
        new-ast
        new-ast-unique-expr
        new-env
        no_list
        persistent-indexer
        pthread-emulation
        qualifiedEnum
        resolv-new
        with_gc
      
      
        
          | 
            Last change
 on this file since 86c8fd6 was             5ea06d6, checked in by Thierry Delisle <tdelisle@…>, 9 years ago           | 
        
        
          | 
             
Prototype of multi monitor internal scheduling 
 
           | 
        
        
          
            
              - 
Property                 mode
 set to                 
100644
               
             
           | 
        
        
          | 
            File size:
            1.4 KB
           | 
        
      
      
| Line |   | 
|---|
| 1 | //                              -*- Mode: CFA -*-
 | 
|---|
| 2 | //
 | 
|---|
| 3 | // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
 | 
|---|
| 4 | //
 | 
|---|
| 5 | // The contents of this file are covered under the licence agreement in the
 | 
|---|
| 6 | // file "LICENCE" distributed with Cforall.
 | 
|---|
| 7 | //
 | 
|---|
| 8 | // monitor --
 | 
|---|
| 9 | //
 | 
|---|
| 10 | // Author           : Thierry Delisle
 | 
|---|
| 11 | // Created On       : Thd Feb 23 12:27:26 2017
 | 
|---|
| 12 | // Last Modified By : Thierry Delisle
 | 
|---|
| 13 | // Last Modified On : --
 | 
|---|
| 14 | // Update Count     : 0
 | 
|---|
| 15 | //
 | 
|---|
| 16 | 
 | 
|---|
| 17 | #ifndef MONITOR_H
 | 
|---|
| 18 | #define MONITOR_H
 | 
|---|
| 19 | 
 | 
|---|
| 20 | #include <stddef.h>
 | 
|---|
| 21 | 
 | 
|---|
| 22 | #include "assert"
 | 
|---|
| 23 | #include "invoke.h"
 | 
|---|
| 24 | #include "stdlib"
 | 
|---|
| 25 | 
 | 
|---|
| 26 | static inline void ?{}(monitor_desc * this) {
 | 
|---|
| 27 |         this->owner = NULL;
 | 
|---|
| 28 |       this->stack_owner = NULL;
 | 
|---|
| 29 |         this->recursion = 0;
 | 
|---|
| 30 | }
 | 
|---|
| 31 | 
 | 
|---|
| 32 | struct monitor_guard_t {
 | 
|---|
| 33 |         monitor_desc ** m;
 | 
|---|
| 34 |         int count;
 | 
|---|
| 35 |       monitor_desc ** prev_mntrs;
 | 
|---|
| 36 |       unsigned short  prev_count;
 | 
|---|
| 37 | };
 | 
|---|
| 38 | 
 | 
|---|
| 39 | static inline int ?<?(monitor_desc* lhs, monitor_desc* rhs) {
 | 
|---|
| 40 |         return ((intptr_t)lhs) < ((intptr_t)rhs);
 | 
|---|
| 41 | }
 | 
|---|
| 42 | 
 | 
|---|
| 43 | void ?{}( monitor_guard_t * this, monitor_desc ** m, int count );
 | 
|---|
| 44 | void ^?{}( monitor_guard_t * this );
 | 
|---|
| 45 | 
 | 
|---|
| 46 | //-----------------------------------------------------------------------------
 | 
|---|
| 47 | // Internal scheduling
 | 
|---|
| 48 | struct condition {
 | 
|---|
| 49 |         __thread_queue_t blocked;
 | 
|---|
| 50 |         monitor_desc ** monitors;
 | 
|---|
| 51 |         unsigned short monitor_count;
 | 
|---|
| 52 | };
 | 
|---|
| 53 | 
 | 
|---|
| 54 | static inline void ?{}( condition * this ) {
 | 
|---|
| 55 |         this->monitors = NULL;
 | 
|---|
| 56 |         this->monitor_count = 0;
 | 
|---|
| 57 | }
 | 
|---|
| 58 | 
 | 
|---|
| 59 | void wait( condition * this );
 | 
|---|
| 60 | void signal( condition * this );
 | 
|---|
| 61 | #endif //MONITOR_H
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.