source:
src/tests/preempt_longrun/enter.c@
704d11e
| Last change on this file since 704d11e was 7bdcac1, checked in by , 7 years ago | |
|---|---|
|
|
| File size: 558 bytes | |
| Rev | Line | |
|---|---|---|
| [8ee50281] | 1 | #include <kernel> |
| 2 | #include <monitor> | |
| 3 | #include <thread> | |
| [b9da9585] | 4 | #include <time> |
| [8ee50281] | 5 | |
| [7bdcac1] | 6 | #include "long_tests.h" |
| 7 | ||
| [8ee50281] | 8 | #ifndef PREEMPTION_RATE |
| [b9da9585] | 9 | #error PREEMPTION_RATE not defined in makefile |
| [8ee50281] | 10 | #endif |
| 11 | ||
| [8ad6533] | 12 | Duration default_preemption() { |
| [8ee50281] | 13 | return PREEMPTION_RATE; |
| 14 | } | |
| 15 | ||
| [b9da9585] | 16 | static const unsigned long N = 2_100_000ul; |
| 17 | ||
| [8ee50281] | 18 | monitor mon_t {}; |
| [7bdcac1] | 19 | void foo( mon_t & mutex this ) { |
| 20 | KICK_WATCHDOG; | |
| 21 | } | |
| [8ee50281] | 22 | |
| [85b1deb] | 23 | mon_t mon; |
| [8ee50281] | 24 | thread worker_t {}; |
| [1449d83] | 25 | void main( worker_t & this ) { |
| [7bdcac1] | 26 | for( unsigned long i = 0; TEST(i < N); i++ ) { |
| [1449d83] | 27 | foo( mon ); |
| [8ee50281] | 28 | } |
| 29 | } | |
| 30 | ||
| 31 | int main(int argc, char * argv[] ) { | |
| 32 | processor p; | |
| 33 | { | |
| 34 | worker_t w[7]; | |
| 35 | } | |
| [1449d83] | 36 | } |
Note:
See TracBrowser
for help on using the repository browser.