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