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
        with_gc
      
      
        
          | 
            Last change
 on this file since 5da5a96 was             8ad6533, checked in by Peter A. Buhr <pabuhr@…>, 8 years ago           | 
        
        
          | 
             
remove cfatime.h, move itimerval constructor to "time", update concurrent examples to use Duration 
 
           | 
        
        
          
            
              - 
Property                 mode
 set to                 
100644
               
             
           | 
        
        
          | 
            File size:
            538 bytes
           | 
        
      
      
| Line |   | 
|---|
| 1 | #include <kernel>
 | 
|---|
| 2 | #include <monitor>
 | 
|---|
| 3 | #include <thread>
 | 
|---|
| 4 | 
 | 
|---|
| 5 | static const unsigned long N  = 2_100_000ul;
 | 
|---|
| 6 | 
 | 
|---|
| 7 | #ifndef PREEMPTION_RATE
 | 
|---|
| 8 | #define PREEMPTION_RATE 10`ms
 | 
|---|
| 9 | #endif
 | 
|---|
| 10 | 
 | 
|---|
| 11 | Duration default_preemption() {
 | 
|---|
| 12 |         return PREEMPTION_RATE;
 | 
|---|
| 13 | }
 | 
|---|
| 14 | 
 | 
|---|
| 15 | monitor mon_t {};
 | 
|---|
| 16 | 
 | 
|---|
| 17 | mon_t mon;
 | 
|---|
| 18 | 
 | 
|---|
| 19 | void foo( mon_t & mutex this ) {}
 | 
|---|
| 20 | 
 | 
|---|
| 21 | thread worker_t {};
 | 
|---|
| 22 | 
 | 
|---|
| 23 | void main( worker_t & this ) {
 | 
|---|
| 24 |         for( unsigned long i = 0; i < N; i++ ) {
 | 
|---|
| 25 |                 foo( mon );
 | 
|---|
| 26 |         }
 | 
|---|
| 27 | }
 | 
|---|
| 28 | 
 | 
|---|
| 29 | extern "C" {
 | 
|---|
| 30 | static worker_t * workers;
 | 
|---|
| 31 | }
 | 
|---|
| 32 | 
 | 
|---|
| 33 | int main(int argc, char * argv[] ) {
 | 
|---|
| 34 |         processor p;
 | 
|---|
| 35 |         {
 | 
|---|
| 36 |                 worker_t w[7];
 | 
|---|
| 37 |                 workers = w;
 | 
|---|
| 38 |         }
 | 
|---|
| 39 | }
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.