source:
src/tests/preempt_longrun/enter3.c
@
6f9bc09
Last change on this file since 6f9bc09 was 8ad6533, checked in by , 6 years ago | |
---|---|
|
|
File size: 593 bytes |
Rev | Line | |
---|---|---|
[8ee50281] | 1 | #include <kernel> |
2 | #include <monitor> | |
3 | #include <thread> | |
4 | ||
[ab0203df] | 5 | static const unsigned long N = 500_000ul; |
[8ee50281] | 6 | |
7 | #ifndef PREEMPTION_RATE | |
[8ad6533] | 8 | #define PREEMPTION_RATE 10`ms |
[8ee50281] | 9 | #endif |
10 | ||
[8ad6533] | 11 | Duration default_preemption() { |
[8ee50281] | 12 | return PREEMPTION_RATE; |
13 | } | |
14 | ||
15 | monitor mon_t {}; | |
16 | ||
17 | mon_t mon1, mon2, mon3; | |
18 | ||
[1449d83] | 19 | void foo( mon_t & mutex a, mon_t & mutex b, mon_t & mutex c ) {} |
[8ee50281] | 20 | |
21 | thread worker_t {}; | |
22 | ||
[1449d83] | 23 | void main( worker_t & this ) { |
[8ee50281] | 24 | for( unsigned long i = 0; i < N; i++ ) { |
[1449d83] | 25 | foo( mon1, mon2, mon3 ); |
[8ee50281] | 26 | } |
27 | } | |
28 | ||
[0322865c] | 29 | extern "C" { |
30 | static worker_t * workers; | |
31 | } | |
32 | ||
[8ee50281] | 33 | int main(int argc, char * argv[] ) { |
34 | processor p; | |
35 | { | |
36 | worker_t w[7]; | |
[0322865c] | 37 | workers = w; |
[8ee50281] | 38 | } |
[1449d83] | 39 | } |
Note: See TracBrowser
for help on using the repository browser.