source:
src/tests/preempt_longrun/yield.c
@
e8db295
Last change on this file since e8db295 was b9da9585, checked in by , 6 years ago | |
---|---|
|
|
File size: 538 bytes |
Rev | Line | |
---|---|---|
[cc3e4d0] | 1 | #include <kernel> |
2 | #include <thread> | |
[b9da9585] | 3 | #include <time> |
[cd99ef1] | 4 | |
[cc3e4d0] | 5 | #ifndef PREEMPTION_RATE |
[b9da9585] | 6 | #error PREEMPTION_RATE not defined in makefile |
[cc3e4d0] | 7 | #endif |
8 | ||
[8ad6533] | 9 | Duration default_preemption() { |
[cc3e4d0] | 10 | return PREEMPTION_RATE; |
11 | } | |
12 | ||
[b9da9585] | 13 | #ifdef LONG_TEST |
14 | static const unsigned long N = 9_750_000ul; | |
15 | #else | |
16 | static const unsigned long N = 325_000ul; | |
17 | #endif | |
18 | ||
[0322865c] | 19 | thread worker_t {}; |
[cc3e4d0] | 20 | |
[1449d83] | 21 | void main(worker_t & this) { |
[cd99ef1] | 22 | for(int i = 0; i < N; i++) { |
[cc3e4d0] | 23 | yield(); |
24 | } | |
25 | } | |
26 | ||
[0322865c] | 27 | extern "C" { |
28 | static worker_t * workers; | |
29 | } | |
30 | ||
[cc3e4d0] | 31 | int main(int argc, char* argv[]) { |
32 | processor p; | |
33 | { | |
[0322865c] | 34 | worker_t w[7]; |
35 | workers = w; | |
[cc3e4d0] | 36 | } |
[1449d83] | 37 | } |
Note: See TracBrowser
for help on using the repository browser.