source: tests/concurrency/waituntil/timeout.cfa @ 5adb277

Last change on this file since 5adb277 was c26bea2a, checked in by Peter A. Buhr <pabuhr@…>, 19 months ago

first attempt at renaming directory tests/concurrent to tests/concurrency to harmonize with other concurrency directory names

  • Property mode set to 100644
File size: 656 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( sleep( 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    printf("done\n");
18}
Note: See TracBrowser for help on using the repository browser.