ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change
on this file since f710aca was
0322865c,
checked in by Thierry Delisle <tdelisle@…>, 7 years ago
|
Cleaned long tests to be more consistent and offer more debug information
|
-
Property mode set to
100644
|
File size:
708 bytes
|
Rev | Line | |
---|
[11dbfe1] | 1 | #include <kernel> |
---|
| 2 | #include <thread> |
---|
| 3 | |
---|
| 4 | #ifndef PREEMPTION_RATE |
---|
| 5 | #define PREEMPTION_RATE 10_000ul |
---|
| 6 | #endif |
---|
| 7 | |
---|
| 8 | unsigned int default_preemption() { |
---|
| 9 | return PREEMPTION_RATE; |
---|
| 10 | } |
---|
| 11 | |
---|
| 12 | static volatile int counter = 0; |
---|
| 13 | |
---|
[0322865c] | 14 | thread worker_t { |
---|
[11dbfe1] | 15 | int value; |
---|
| 16 | }; |
---|
| 17 | |
---|
[0322865c] | 18 | void ?{}( worker_t * this, int value ) { |
---|
[11dbfe1] | 19 | this->value = value; |
---|
| 20 | } |
---|
| 21 | |
---|
[0322865c] | 22 | void main(worker_t * this) { |
---|
[11dbfe1] | 23 | while(counter < 1000) { |
---|
| 24 | if( (counter % 7) == this->value ) { |
---|
| 25 | int next = __atomic_add_fetch_4(&counter, 1, __ATOMIC_SEQ_CST); |
---|
| 26 | if( (next % 100) == 0 ) printf("%d\n", next); |
---|
| 27 | } |
---|
| 28 | } |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | int main(int argc, char* argv[]) { |
---|
| 32 | processor p; |
---|
| 33 | { |
---|
[0322865c] | 34 | worker_t w0 = 0; |
---|
| 35 | worker_t w1 = 1; |
---|
| 36 | worker_t w2 = 2; |
---|
| 37 | worker_t w3 = 3; |
---|
| 38 | worker_t w4 = 4; |
---|
| 39 | worker_t w5 = 5; |
---|
| 40 | worker_t w6 = 6; |
---|
[11dbfe1] | 41 | } |
---|
| 42 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.