Sophie

Sophie

distrib > Mageia > 7 > armv7hl > by-pkgid > 2b917e0437961edec048f1d15e2d7449 > files > 6159

php-manual-en-7.2.11-1.mga7.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Get a semaphore id</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.sem-acquire.html">sem_acquire</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.sem-release.html">sem_release</a></div>
 <div class="up"><a href="ref.sem.html">Semaphore Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.sem-get" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">sem_get</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">sem_get</span> &mdash; <span class="dc-title">Get a semaphore id</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.sem-get-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">resource</span> <span class="methodname"><strong>sem_get</strong></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$key</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$max_acquire</code><span class="initializer"> = 1</span></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$perm</code><span class="initializer"> = 0666</span></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$auto_release</code><span class="initializer"> = 1</span></span>
  ]]] )</div>

  <p class="para rdfs-comment">
   <span class="function"><strong>sem_get()</strong></span> returns an id that can be used to
   access the System V semaphore with the given <code class="parameter">key</code>.
  </p>
  <p class="para">
   A second call to <span class="function"><strong>sem_get()</strong></span> for the same key
   will return a different semaphore identifier, but both
   identifiers access the same underlying semaphore.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.sem-get-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">key</code></dt>

     <dd>

      <p class="para">
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">max_acquire</code></dt>

     <dd>

      <p class="para">
       The number of processes that can acquire the semaphore simultaneously
       is set to <code class="parameter">max_acquire</code>.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">perm</code></dt>

     <dd>

      <p class="para">
       The semaphore permissions. Actually this value is
       set only if the process finds it is the only process currently
       attached to the semaphore.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">auto_release</code></dt>

     <dd>

      <p class="para">
       Specifies if the semaphore should be automatically released on request
       shutdown.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.sem-get-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns a positive semaphore identifier on success, or <strong><code>FALSE</code></strong> on
   error.
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.sem-get-notes">
  <h3 class="title">Notes</h3>
  <div class="warning"><strong class="warning">Warning</strong>
   <p class="simpara">
    When using <span class="function"><strong>sem_get()</strong></span> to access a semaphore created
    outside PHP, note that the semaphore must have been created as a set of 3
    semaphores (for example, by specifying 3 as the <em>nsems</em>
    parameter when calling the C <em>semget()</em> function),
    otherwise PHP will be unable to access the semaphore.
   </p>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.sem-get-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.sem-acquire.html" class="function" rel="rdfs-seeAlso">sem_acquire()</a> - Acquire a semaphore</span></li>
    <li class="member"><span class="function"><a href="function.sem-release.html" class="function" rel="rdfs-seeAlso">sem_release()</a> - Release a semaphore</span></li>
    <li class="member"><span class="function"><a href="function.ftok.html" class="function" rel="rdfs-seeAlso">ftok()</a> - Convert a pathname and a project identifier to a System V IPC key</span></li>
   </ul>
  </p>
 </div>
  

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.sem-acquire.html">sem_acquire</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.sem-release.html">sem_release</a></div>
 <div class="up"><a href="ref.sem.html">Semaphore Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>