24 lines
563 B
C
24 lines
563 B
C
#include<pthread.h>
|
|
#include<stdio.h>
|
|
#include<stdlib.h>
|
|
#include<unistd.h>
|
|
#include<time.h>
|
|
#include<sys/time.h>
|
|
|
|
void* run (void* arg){
|
|
printf("Hello from run\n");
|
|
return NULL;
|
|
}
|
|
|
|
int main(){
|
|
pthread_t thread;
|
|
pthread_create(&thread, NULL, &run, NULL);
|
|
// While the sleep() function will appear to provide synchronization,
|
|
// it is incorrect, and if used for this purposes instead of join
|
|
// or synchronization mechanism - the grade for the assignment will be
|
|
// reduced
|
|
sleep(2);
|
|
printf("Back in main");
|
|
return 0;
|
|
}
|