25 Nisan 2021 Pazar

Threadlere özgü alanlar (pthread_key_create fonksiyonu)

 #include <string.h> #include <unistd.h> #include <pthread.h> #include <stdio.h> #include <stdlib.h> typedef struct tagPERSON { char name[32]; int no; } PERSON; void *thread_proc1(void *param); void *thread_proc2(void *param); void foo(void); pthread_key_t g_slotKey; int main(void) { pthread_t tid1, tid2; int result; if (pthread_key_create(&g_slotKey,...
Share:

23 Nisan 2021 Cuma

Unix Linux sistemlerinde Semapor kullanımı

  #include <stdio.h> #include <string.h> #include<unistd.h> #include<semaphore.h> #include<pthread.h> #include <stdlib.h> void exit_sys(const char* msg); void exit_sys_result(const char *msg,int result); void *thread_proc1(void *param); void *thread_proc2(void *param); void do_something(const char *msg); sem_t g_sem; int main(void) { printf("Hello...
Share: