Last active
May 13, 2019 19:41
-
-
Save starzia/505626ec439396733b4426f456db401b to your computer and use it in GitHub Desktop.
A xv6 program that makes threads and then exits without cleaning them up.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "types.h" | |
#include "stat.h" | |
#include "user.h" | |
void run(void* id) { | |
printf(1, "hello\n"); | |
volatile int i; | |
for(i=0; i<100000000; i++); | |
printf(1, "Child %d done\n", *(int*)id); | |
} | |
int main(int argc, char *argv[]) { | |
int one = 1; | |
int two = 2; | |
thread_create(run, &one); | |
thread_create(run, &two); | |
printf(1, "now exit without waiting for children\n"); | |
exit(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment