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 9191a8e was
d6ff3ff,
checked in by Thierry Delisle <tdelisle@…>, 7 years ago
|
Kernel shoud now drop preemptions during other preemptions
|
-
Property mode set to
100644
|
File size:
494 bytes
|
Rev | Line | |
---|
[5013c62] | 1 | #include <pthread.h> |
---|
| 2 | #include <err.h> |
---|
| 3 | #include <stdlib.h> |
---|
| 4 | #include <stdio.h> |
---|
| 5 | |
---|
| 6 | static void *foo(void *arg) { |
---|
| 7 | return arg; |
---|
| 8 | } |
---|
| 9 | |
---|
| 10 | int main(int argc, char* argv[]) { |
---|
| 11 | size_t n = 1000000; |
---|
| 12 | if( argc > 2 ) return 1; |
---|
| 13 | if( argc == 2 ) { |
---|
| 14 | n = atoi(argv[1]); |
---|
| 15 | } |
---|
| 16 | printf("%lu\n", n); |
---|
| 17 | |
---|
| 18 | for (size_t i = 0; i < n; i++) { |
---|
[d6ff3ff] | 19 | pthread_t thread; |
---|
| 20 | if (pthread_create(&thread, NULL, foo, NULL) < 0) { |
---|
[5013c62] | 21 | return 1; |
---|
| 22 | } |
---|
[d6ff3ff] | 23 | |
---|
| 24 | if (pthread_join( thread, NULL) < 0) { |
---|
[5013c62] | 25 | return 1; |
---|
| 26 | } |
---|
| 27 | } |
---|
| 28 | pthread_exit(NULL); |
---|
| 29 | return 0; |
---|
| 30 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.