home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 May / Chip_2000-05_cd1.bin / zkuste / Perl / ActivePerl-5.6.0.613.msi / 䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥 / _4dfbde8f348f880ce1e92f6e1f0945a5 < prev    next >
Text File  |  2000-03-23  |  6KB  |  186 lines

  1.  
  2. <HTML>
  3. <HEAD>
  4. <TITLE>IPC::Semaphore - SysV Semaphore IPC object class</TITLE>
  5. <LINK REL="stylesheet" HREF="../../Active.css" TYPE="text/css">
  6. <LINK REV="made" HREF="mailto:">
  7. </HEAD>
  8.  
  9. <BODY>
  10. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  11. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  12. <STRONG><P CLASS=block> IPC::Semaphore - SysV Semaphore IPC object class</P></STRONG>
  13. </TD></TR>
  14. </TABLE>
  15.  
  16. <A NAME="__index__"></A>
  17. <!-- INDEX BEGIN -->
  18.  
  19. <UL>
  20.  
  21.     <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
  22.  
  23.     <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
  24.     <LI><A HREF="#description">DESCRIPTION</A></LI>
  25.     <LI><A HREF="#methods">METHODS</A></LI>
  26.     <LI><A HREF="#see also">SEE ALSO</A></LI>
  27.     <LI><A HREF="#author">AUTHOR</A></LI>
  28.     <LI><A HREF="#copyright">COPYRIGHT</A></LI>
  29. </UL>
  30. <!-- INDEX END -->
  31.  
  32. <HR>
  33. <P>
  34. <H1><A NAME="name">NAME</A></H1>
  35. <P>IPC::Semaphore - SysV Semaphore IPC object class</P>
  36. <P>
  37. <HR>
  38. <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
  39. <UL>
  40. <LI>Linux</LI>
  41. <LI>Solaris</LI>
  42. </UL>
  43. <HR>
  44. <H1><A NAME="synopsis">SYNOPSIS</A></H1>
  45. <PRE>
  46.     use IPC::SysV qw(IPC_PRIVATE S_IRWXU IPC_CREAT);
  47.     use IPC::Semaphore;</PRE>
  48. <PRE>
  49.     $sem = new IPC::Semaphore(IPC_PRIVATE, 10, S_IRWXU | IPC_CREAT);</PRE>
  50. <PRE>
  51.     $sem->setall( (0) x 10);</PRE>
  52. <PRE>
  53.     @sem = $sem->getall;</PRE>
  54. <PRE>
  55.     $ncnt = $sem->getncnt;</PRE>
  56. <PRE>
  57.     $zcnt = $sem->getzcnt;</PRE>
  58. <PRE>
  59.     $ds = $sem->stat;</PRE>
  60. <PRE>
  61.     $sem->remove;</PRE>
  62. <P>
  63. <HR>
  64. <H1><A NAME="description">DESCRIPTION</A></H1>
  65. <P>
  66. <HR>
  67. <H1><A NAME="methods">METHODS</A></H1>
  68. <DL>
  69. <DT><STRONG><A NAME="item_new">new ( KEY , NSEMS , FLAGS )</A></STRONG><BR>
  70. <DD>
  71. Create a new semaphore set associated with <CODE>KEY</CODE>. <CODE>NSEMS</CODE> is the number
  72. of semaphores in the set. A new set is created if
  73. <UL>
  74. <LI>
  75. <CODE>KEY</CODE> is equal to <CODE>IPC_PRIVATE</CODE>
  76. <P></P>
  77. <LI>
  78. <CODE>KEY</CODE> does not already  have  a  semaphore  identifier
  79. associated with it, and <CODE>FLAGS & IPC_CREAT</CODE> is true.
  80. <P></P></UL>
  81. <P>On creation of a new semaphore set <CODE>FLAGS</CODE> is used to set the
  82. permissions.</P>
  83. <DT><STRONG><A NAME="item_getall">getall</A></STRONG><BR>
  84. <DD>
  85. Returns the values of the semaphore set as an array.
  86. <P></P>
  87. <DT><STRONG><A NAME="item_getncnt">getncnt ( SEM )</A></STRONG><BR>
  88. <DD>
  89. Returns the number of processed waiting for the semaphore <CODE>SEM</CODE> to
  90. become greater than it's current value
  91. <P></P>
  92. <DT><STRONG><A NAME="item_getpid">getpid ( SEM )</A></STRONG><BR>
  93. <DD>
  94. Returns the process id of the last process that performed an operation
  95. on the semaphore <CODE>SEM</CODE>.
  96. <P></P>
  97. <DT><STRONG><A NAME="item_getval">getval ( SEM )</A></STRONG><BR>
  98. <DD>
  99. Returns the current value of the semaphore <CODE>SEM</CODE>.
  100. <P></P>
  101. <DT><STRONG><A NAME="item_getzcnt">getzcnt ( SEM )</A></STRONG><BR>
  102. <DD>
  103. Returns the number of processed waiting for the semaphore <CODE>SEM</CODE> to
  104. become zero.
  105. <P></P>
  106. <DT><STRONG><A NAME="item_id">id</A></STRONG><BR>
  107. <DD>
  108. Returns the system identifier for the semaphore set.
  109. <P></P>
  110. <DT><STRONG><A NAME="item_op">op ( OPLIST )</A></STRONG><BR>
  111. <DD>
  112. <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
  113. a concatenation of smaller lists, each which has three values. The
  114. first is the semaphore number, the second is the operation and the last
  115. is a flags value. See <A HREF="../../lib/Pod/perlfunc.html#item_semop">semop</A> for more details. For example
  116. <PRE>
  117.     $sem->op(
  118.         0, -1, IPC_NOWAIT,
  119.         1,  1, IPC_NOWAIT
  120.     );</PRE>
  121. <P></P>
  122. <DT><STRONG><A NAME="item_remove">remove</A></STRONG><BR>
  123. <DD>
  124. Remove and destroy the semaphore set from the system.
  125. <P></P>
  126. <DT><STRONG><A NAME="item_set">set ( STAT )</A></STRONG><BR>
  127. <DD>
  128. <DT><STRONG>set ( NAME => VALUE [, NAME => VALUE ...] )</STRONG><BR>
  129. <DD>
  130. <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
  131. with the semaphore set.
  132. <PRE>
  133.     uid
  134.     gid
  135.     mode (oly the permission bits)</PRE>
  136. <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,
  137. or a list of <EM>name</EM>-<EM>value</EM> pairs.</P>
  138. <P></P>
  139. <DT><STRONG><A NAME="item_setall">setall ( VALUES )</A></STRONG><BR>
  140. <DD>
  141. Sets all values in the semaphore set to those given on the <CODE>VALUES</CODE> list.
  142. <CODE>VALUES</CODE> must contain the correct number of values.
  143. <P></P>
  144. <DT><STRONG><A NAME="item_setval">setval ( N , VALUE )</A></STRONG><BR>
  145. <DD>
  146. Set the <CODE>N</CODE>th value in the semaphore set to <CODE>VALUE</CODE>
  147. <P></P>
  148. <DT><STRONG><A NAME="item_stat">stat</A></STRONG><BR>
  149. <DD>
  150. Returns an object of type <CODE>IPC::Semaphore::stat</CODE> which is a sub-class of
  151. <CODE>Class::Struct</CODE>. It provides the following fields. For a description
  152. of these fields see you system documentation.
  153. <PRE>
  154.     uid
  155.     gid
  156.     cuid
  157.     cgid
  158.     mode
  159.     ctime
  160.     otime
  161.     nsems</PRE>
  162. <P></P></DL>
  163. <P>
  164. <HR>
  165. <H1><A NAME="see also">SEE ALSO</A></H1>
  166. <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>
  167. <P>
  168. <HR>
  169. <H1><A NAME="author">AUTHOR</A></H1>
  170. <P>Graham Barr <<A HREF="mailto:gbarr@pobox.com">gbarr@pobox.com</A>></P>
  171. <P>
  172. <HR>
  173. <H1><A NAME="copyright">COPYRIGHT</A></H1>
  174. <P>Copyright (c) 1997 Graham Barr. All rights reserved.
  175. This program is free software; you can redistribute it and/or modify it
  176. under the same terms as Perl itself.</P>
  177. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  178. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  179. <STRONG><P CLASS=block> IPC::Semaphore - SysV Semaphore IPC object class</P></STRONG>
  180. </TD></TR>
  181. </TABLE>
  182.  
  183. </BODY>
  184.  
  185. </HTML>
  186.