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

Last change on this file since 41882628 was d5926ae, checked in by caparsons <caparson@…>, 16 months ago

modified waituntil tests to test new features

  • Property mode set to 100644
File size: 675 bytes
RevLine 
[8cb06b6]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 );
[d5926ae]17    sleep( 1`ms );
[8cb06b6]18    printf("done\n");
19}
Note: See TracBrowser for help on using the repository browser.