ADTarm-ehast-experimentalcleanup-dtorsenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since 172d9342 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 | |
---|
7 | void noOp(void) {} |
---|
8 | |
---|
9 | coroutine GreatSuspender {}; |
---|
10 | |
---|
11 | void ?{}( GreatSuspender & this ) { |
---|
12 | prime(this); |
---|
13 | } |
---|
14 | |
---|
15 | void main( __attribute__((unused)) GreatSuspender & this ) { |
---|
16 | while( true ) { |
---|
17 | suspend_then(noOp); |
---|
18 | } |
---|
19 | } |
---|
20 | |
---|
21 | int 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.