source: src/benchmark/create_pthrd.c @ 24fc196

aaron-thesisarm-ehcleanup-dtorsdeferred_resndemanglerjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerresolv-newwith_gc
Last change on this file since 24fc196 was d6ff3ff, checked in by Thierry Delisle <tdelisle@…>, 4 years ago

Kernel shoud now drop preemptions during other preemptions

  • Property mode set to 100644
File size: 494 bytes
Line 
1#include <pthread.h>
2#include <err.h>
3#include <stdlib.h>
4#include <stdio.h>
5
6static void *foo(void *arg) {
7    return arg;
8}
9
10int 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++) {
19                pthread_t thread;
20                if (pthread_create(&thread, NULL, foo, NULL) < 0) {
21                        return 1;
22                }
23
24                if (pthread_join( thread, NULL) < 0) {
25                        return 1;
26                }
27        }
28        pthread_exit(NULL);
29        return 0;
30}
Note: See TracBrowser for help on using the repository browser.