mirror of https://github.com/t1meshift/os_labs.git
20 lines
322 B
C
20 lines
322 B
C
|
#include <stdio.h>
|
||
|
|
||
|
#include "mythread.h"
|
||
|
|
||
|
int done = 0;
|
||
|
|
||
|
void* worker(void* arg) {
|
||
|
printf("this should print first\n");
|
||
|
done = 1;
|
||
|
return NULL;
|
||
|
}
|
||
|
|
||
|
int main(int argc, char *argv[]) {
|
||
|
pthread_t p;
|
||
|
Pthread_create(&p, NULL, worker, NULL);
|
||
|
while (done == 0)
|
||
|
;
|
||
|
printf("this should print last\n");
|
||
|
return 0;
|
||
|
}
|