source: benchmark/ctxswitch/cfa_cor_then.cfa@ b117e0c

ADT arm-eh ast-experimental enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr pthread-emulation qualifiedEnum
Last change on this file since b117e0c was 5b11c25, checked in by Thierry Delisle <tdelisle@…>, 6 years ago

Added new suspen_then function which runs a callback in the middle of susending

  • Property mode set to 100644
File size: 453 bytes
Line 
1#include <stdio.h>
2#include <kernel.hfa>
3#include <thread.hfa>
4
5#include "bench.h"
6
7void noOp(void) {}
8
9coroutine GreatSuspender {};
10
11void ?{}( GreatSuspender & this ) {
12 prime(this);
13}
14
15void main( __attribute__((unused)) GreatSuspender & this ) {
16 while( true ) {
17 suspend_then(noOp);
18 }
19}
20
21int main(int argc, char* argv[]) {
22 GreatSuspender s;
23
24 BENCH(
25 for (size_t i = 0; i < n; i++) {
26 resume( s );
27 },
28 result
29 )
30
31 printf("%llu\n", result);
32}
Note: See TracBrowser for help on using the repository browser.