Files
OS_Emil_Shanayev/Lab5/ex1.c
T
2024-09-24 19:25:47 +03:00

37 lines
643 B
C

#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
/*
pthread_t phread_self(void);
void * start_routine(void * arg);
int pthread_create(pthread_t * thread, const pthread_attr_t * attr,
void *(start_routine)(void *), void * arg);
void pthread_exit(void *retval);
*/
void * start_routine(void * arg) {
int pid = pthread_self();
printf("%d\n",pid);
return NULL;
}
int main() {
int val1 = 5;
int val2 = 11;
pthread_t thread1;
pthread_t thread2;
pthread_create(&thread1, NULL, &start_routine, NULL);
pthread_create(&thread2, NULL, &start_routine, NULL);
printf("Program started!\n");
pthread_exit(NULL);
return 0;
}