Re: Whether Linux implement POSIX Semaphore??

From: Karen Shaeffer (shaeffer@best.com)
Date: Thu May 04 2000 - 12:20:14 EST


On Thu, May 04, 2000 at 10:13:21PM +0800, Ariel Chen wrote:
> I write a test file for POSIX Semaphore!!
> I have see the semaphore manual page in Linux (use man sem_init) .
> But the file can't be complied. It appears some errors.
> So, I am not sure whether Linux implement POSIX semaphore??
> Thanks!
> ===========================================
> #include <stdio.h>
> #include <semaphore.h>
> #include <stdlib.h>
> #include <unistd.h>
>
> int main(void)
> {
> sem_t sem;
> int i;
>
> if( sem_init(&sem,1,1)==-1)
> perror("sem_init");
---end quoted text---

This quote comes from the man page you refer to:

<quote>
       sem_init initializes the semaphore object pointed to by sem. The count associ­
       ated with the semaphore is set initially to value. The pshared argument indi­
       cates whether the semaphore is local to the current process ( pshared is zero) or
       is to be shared between several processes ( pshared is not zero). LinuxThreads
       currently does not support process-shared semaphores, thus sem_init always
       returns with error ENOSYS if pshared is not zero.
</quote>

Karen

-- 
----
  Karen Shaeffer
  Neuralscape; Santa Cruz, Ca. 95060
  shaeffer@neuralscape.com  http://www.neuralscape.com
-------------------------------------------------------

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun May 07 2000 - 21:00:15 EST