Thanks for the info.
Including -lpthread did it.
As for the man pages, I was actually trying out with the info pages. But I guess man pages are better than info's.
Thanks again, as I solved the compilation issue, and am into a runtime issue now.
Anyways, the semaphores are working fine now...