Linux에서 Posix Semaphore 사용 가능한가요..?

psjcap의 이미지

sem_init 함수에 man page를 보면..

LinuxThreads currently does not support  process-shared semaphores,  thus  sem_init always returns with error ENOSYS if  pshared is not zero.

이렇게 되어 있네요...
근데 실행하면 ENOSYS가 리턴되지는 않는 것 같거든요..

그리고 한가지더 질문이 있는데요..
shared memory에 sem_init으로 semaphore 생성하고..
sem_destroy 않 하고 shared memory만 삭제하면 어떻게 되나여.?
자동 삭젠가여.? 아님.. 메모리에 계속 쌓이나여.?

익명 사용자의 이미지

int sem_init(sem_t *sem, int pshared, unsigned int value);

returns with error ENOSYS if pshared is not zero.

pshared에 1을 넣고 해도 그렇던가요?

psjcap의 이미지

1을 넣었을 때 동작하는것 같더군요..

한쪽 process에서는 초기화 하고..
다른 process에서 sem_trywait 하는데요..
에러 없이 잘 됩니다..

man page가 업데이트가 않된건지...
Linux Kernel 버전은 2.4.20-8 #1 이라고 나오네요..~