Semaphore
Posix
#include <semaphore.h>
구조체
sem_t sem;초기화
sem_init(&sem, 0, 1);wait
sem_wait(&sem);post
sem_post(&sem);destroy
sem_destroy(&sem);osx
#include <dispatch/dispatch.h>
구조체
dispatch_semaphore_t sem;초기화
sem = dispatch_semaphore_create(1);wait
dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);post
dispatch_semaphore_signal(sem);destory
API 없음Windows
#include <Windows.h>
댓글 없음:
댓글 쓰기