What is the difference between sema_init and sem_init ? Are there any specific usage scenarios and other dependencies for the respective APIs ?
2 Answers
Since you tagged this with "linux" I'll ignore other Unixes.
sema_init is the Linux kernel's counting semaphore implementation initialization function.
sem_init is the initializer from the Posix thread library (and is therefore used by userspace code).
- sema_init is from the Solaris thread library.
- sem_init is from the Posix pthread library.