home *** CD-ROM | disk | FTP | other *** search
-
- <HTML>
- <HEAD>
- <TITLE>IPC::Semaphore - SysV Semaphore IPC object class</TITLE>
- <LINK REL="stylesheet" HREF="../../Active.css" TYPE="text/css">
- <LINK REV="made" HREF="mailto:">
- </HEAD>
-
- <BODY>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> IPC::Semaphore - SysV Semaphore IPC object class</P></STRONG>
- </TD></TR>
- </TABLE>
-
- <A NAME="__index__"></A>
- <!-- INDEX BEGIN -->
-
- <UL>
-
- <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
-
- <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
- <LI><A HREF="#description">DESCRIPTION</A></LI>
- <LI><A HREF="#methods">METHODS</A></LI>
- <LI><A HREF="#see also">SEE ALSO</A></LI>
- <LI><A HREF="#author">AUTHOR</A></LI>
- <LI><A HREF="#copyright">COPYRIGHT</A></LI>
- </UL>
- <!-- INDEX END -->
-
- <HR>
- <P>
- <H1><A NAME="name">NAME</A></H1>
- <P>IPC::Semaphore - SysV Semaphore IPC object class</P>
- <P>
- <HR>
- <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
- <UL>
- <LI>Linux</LI>
- <LI>Solaris</LI>
- </UL>
- <HR>
- <H1><A NAME="synopsis">SYNOPSIS</A></H1>
- <PRE>
- use IPC::SysV qw(IPC_PRIVATE S_IRWXU IPC_CREAT);
- use IPC::Semaphore;</PRE>
- <PRE>
- $sem = new IPC::Semaphore(IPC_PRIVATE, 10, S_IRWXU | IPC_CREAT);</PRE>
- <PRE>
- $sem->setall( (0) x 10);</PRE>
- <PRE>
- @sem = $sem->getall;</PRE>
- <PRE>
- $ncnt = $sem->getncnt;</PRE>
- <PRE>
- $zcnt = $sem->getzcnt;</PRE>
- <PRE>
- $ds = $sem->stat;</PRE>
- <PRE>
- $sem->remove;</PRE>
- <P>
- <HR>
- <H1><A NAME="description">DESCRIPTION</A></H1>
- <P>
- <HR>
- <H1><A NAME="methods">METHODS</A></H1>
- <DL>
- <DT><STRONG><A NAME="item_new">new ( KEY , NSEMS , FLAGS )</A></STRONG><BR>
- <DD>
- Create a new semaphore set associated with <CODE>KEY</CODE>. <CODE>NSEMS</CODE> is the number
- of semaphores in the set. A new set is created if
- <UL>
- <LI>
- <CODE>KEY</CODE> is equal to <CODE>IPC_PRIVATE</CODE>
- <P></P>
- <LI>
- <CODE>KEY</CODE> does not already have a semaphore identifier
- associated with it, and <CODE>FLAGS & IPC_CREAT</CODE> is true.
- <P></P></UL>
- <P>On creation of a new semaphore set <CODE>FLAGS</CODE> is used to set the
- permissions.</P>
- <DT><STRONG><A NAME="item_getall">getall</A></STRONG><BR>
- <DD>
- Returns the values of the semaphore set as an array.
- <P></P>
- <DT><STRONG><A NAME="item_getncnt">getncnt ( SEM )</A></STRONG><BR>
- <DD>
- Returns the number of processed waiting for the semaphore <CODE>SEM</CODE> to
- become greater than it's current value
- <P></P>
- <DT><STRONG><A NAME="item_getpid">getpid ( SEM )</A></STRONG><BR>
- <DD>
- Returns the process id of the last process that performed an operation
- on the semaphore <CODE>SEM</CODE>.
- <P></P>
- <DT><STRONG><A NAME="item_getval">getval ( SEM )</A></STRONG><BR>
- <DD>
- Returns the current value of the semaphore <CODE>SEM</CODE>.
- <P></P>
- <DT><STRONG><A NAME="item_getzcnt">getzcnt ( SEM )</A></STRONG><BR>
- <DD>
- Returns the number of processed waiting for the semaphore <CODE>SEM</CODE> to
- become zero.
- <P></P>
- <DT><STRONG><A NAME="item_id">id</A></STRONG><BR>
- <DD>
- Returns the system identifier for the semaphore set.
- <P></P>
- <DT><STRONG><A NAME="item_op">op ( OPLIST )</A></STRONG><BR>
- <DD>
- <CODE>OPLIST</CODE> is a list of operations to pass to <A HREF="../../lib/Pod/perlfunc.html#item_semop"><CODE>semop</CODE></A>. <CODE>OPLIST</CODE> is
- a concatenation of smaller lists, each which has three values. The
- first is the semaphore number, the second is the operation and the last
- is a flags value. See <A HREF="../../lib/Pod/perlfunc.html#item_semop">semop</A> for more details. For example
- <PRE>
- $sem->op(
- 0, -1, IPC_NOWAIT,
- 1, 1, IPC_NOWAIT
- );</PRE>
- <P></P>
- <DT><STRONG><A NAME="item_remove">remove</A></STRONG><BR>
- <DD>
- Remove and destroy the semaphore set from the system.
- <P></P>
- <DT><STRONG><A NAME="item_set">set ( STAT )</A></STRONG><BR>
- <DD>
- <DT><STRONG>set ( NAME => VALUE [, NAME => VALUE ...] )</STRONG><BR>
- <DD>
- <A HREF="#item_set"><CODE>set</CODE></A> will set the following values of the <A HREF="#item_stat"><CODE>stat</CODE></A> structure associated
- with the semaphore set.
- <PRE>
- uid
- gid
- mode (oly the permission bits)</PRE>
- <P><A HREF="#item_set"><CODE>set</CODE></A> accepts either a stat object, as returned by the <A HREF="#item_stat"><CODE>stat</CODE></A> method,
- or a list of <EM>name</EM>-<EM>value</EM> pairs.</P>
- <P></P>
- <DT><STRONG><A NAME="item_setall">setall ( VALUES )</A></STRONG><BR>
- <DD>
- Sets all values in the semaphore set to those given on the <CODE>VALUES</CODE> list.
- <CODE>VALUES</CODE> must contain the correct number of values.
- <P></P>
- <DT><STRONG><A NAME="item_setval">setval ( N , VALUE )</A></STRONG><BR>
- <DD>
- Set the <CODE>N</CODE>th value in the semaphore set to <CODE>VALUE</CODE>
- <P></P>
- <DT><STRONG><A NAME="item_stat">stat</A></STRONG><BR>
- <DD>
- Returns an object of type <CODE>IPC::Semaphore::stat</CODE> which is a sub-class of
- <CODE>Class::Struct</CODE>. It provides the following fields. For a description
- of these fields see you system documentation.
- <PRE>
- uid
- gid
- cuid
- cgid
- mode
- ctime
- otime
- nsems</PRE>
- <P></P></DL>
- <P>
- <HR>
- <H1><A NAME="see also">SEE ALSO</A></H1>
- <P><A HREF="../../lib/IPC/SysV.html">the IPC::SysV manpage</A> <A HREF="../../lib/Class/Struct.html">the Class::Struct manpage</A> <A HREF="../../lib/Pod/perlfunc.html#item_semget">semget</A> <A HREF="../../lib/Pod/perlfunc.html#item_semctl">semctl</A> <A HREF="../../lib/Pod/perlfunc.html#item_semop">semop</A></P>
- <P>
- <HR>
- <H1><A NAME="author">AUTHOR</A></H1>
- <P>Graham Barr <<A HREF="mailto:gbarr@pobox.com">gbarr@pobox.com</A>></P>
- <P>
- <HR>
- <H1><A NAME="copyright">COPYRIGHT</A></H1>
- <P>Copyright (c) 1997 Graham Barr. All rights reserved.
- This program is free software; you can redistribute it and/or modify it
- under the same terms as Perl itself.</P>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> IPC::Semaphore - SysV Semaphore IPC object class</P></STRONG>
- </TD></TR>
- </TABLE>
-
- </BODY>
-
- </HTML>
-