Notice
Recent Posts
Recent Comments
Link
목록thread (1)
Little Jay
[OS] pthread.h 실행 명령어
#include #include #include #include #include #define ITER 1000 void *thread_increment(void * arg); void *thread_decrement(void * arg); int x; sem_t s; int main() { pthread_t tid1, tid2; sem_init(&s, 0, 1); pthread_create(&tid1, NULL, thread_increment, NULL); pthread_create(&tid2, NULL, thread_decrement, NULL); pthread_join(tid1, NULL); pthread_join(tid2, NULL); if (x != 0 ) printf("boom! counter..
Univ/Study
2022. 5. 10. 15:29