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