Difference Between Sem_Init and Sema_Init

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.

See Threads: Basic Theory and Libraries

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest