source: tests/concurrency/waituntil/timeout.cfa @ e1358c0

Last change on this file since e1358c0 was e1358c0, checked in by kyoung <lseo@…>, 6 days ago

create waituntil timeout node as literal via macro as a workaround for upcoming change in dlist copy ctor/raii changes

  • Property mode set to 100644
File size: 687 bytes
Line 
1#include <time.hfa>
2#include <alarm.hfa>
3#include <select.hfa>
4#include <stdbool.h>
5#include <stdio.h>
6
7int main() {
8    waituntil( _timeout( 1`ms ) ) { printf("timeout\n"); }
9    waituntil( _timeout( 1`s ) ) { printf("timeout\n"); } or waituntil( _timeout( 2`s ) ) { printf("timeout\n"); }
10    waituntil( _timeout( 100`s ) ) { printf("timeout 1\n"); } or else { printf("else\n"); }
11    waituntil( _timeout( 1`ns ) ) { printf("timeout\n"); } and waituntil( _timeout( 2`s ) ) { printf("timeout\n"); }
12    int count = 0;
13    for ( i; 1000 )
14        waituntil( _timeout( 1`ns ) ) { count++; } or else { count++; }
15
16    assert( count == 1000 );
17    _timeout( 1`ms );
18    printf("done\n");
19}
Note: See TracBrowser for help on using the repository browser.