<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.syncsharedmemory.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'syncsharedmemory.construct.php',
    1 => 'SyncSharedMemory::__construct',
    2 => 'Constructs a new SyncSharedMemory object',
  ),
  'up' => 
  array (
    0 => 'class.syncsharedmemory.php',
    1 => 'SyncSharedMemory',
  ),
  'prev' => 
  array (
    0 => 'class.syncsharedmemory.php',
    1 => 'SyncSharedMemory',
  ),
  'next' => 
  array (
    0 => 'syncsharedmemory.first.php',
    1 => 'SyncSharedMemory::first',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/sync/syncsharedmemory/construct.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="syncsharedmemory.construct" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">SyncSharedMemory::__construct</h1>
  <p class="verinfo">(PECL sync &gt;= 1.1.0)</p><p class="refpurpose"><span class="refname">SyncSharedMemory::__construct</span> &mdash; <span class="dc-title">Constructs a new SyncSharedMemory object</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-syncsharedmemory.construct-description">
  <h3 class="title">Опис</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>SyncSharedMemory::__construct</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$name</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$size</code></span>)</div>

  <p class="para rdfs-comment">
   Constructs a named shared memory object.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-syncsharedmemory.construct-parameters">
  <h3 class="title">Параметри</h3>
  <dl>
   
    <dt><code class="parameter">name</code></dt>
    <dd>
     <p class="para">
      The name of the shared memory object.
     </p>
     <blockquote class="note"><p><strong class="note">Зауваження</strong>: 
      <p class="para">
       If the name already exists, it must be able to be opened by the current user
       that the process is running as or an exception will be thrown with a meaningless
       error message.
      </p>
     </p></blockquote>
    </dd>
   
   
    <dt><code class="parameter">size</code></dt>
    <dd>
     <p class="para">
      The size, in bytes, of shared memory to reserve.
     </p>
     <blockquote class="note"><p><strong class="note">Зауваження</strong>: 
      <p class="para">
       The amount of memory cannot be resized later.  Request sufficient storage up front.
      </p>
     </p></blockquote>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-syncsharedmemory.construct-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   The new <span class="classname"><a href="class.syncsharedmemory.php" class="classname">SyncSharedMemory</a></span> object.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-syncsharedmemory.construct-errors">
  <h3 class="title">Помилки/виключення</h3>
  <p class="para">
   An exception is thrown if the shared memory object cannot be created or opened.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-syncsharedmemory.construct-examples">
  <h3 class="title">Приклади</h3>
  <div class="example" id="example-1">
   <p><strong>Приклад #1 <span class="function"><strong>SyncSharedMemory::__construct()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">// You will probably need to protect shared memory with other synchronization objects.<br />// Shared memory goes away when the last reference to it disappears.<br /></span><span style="color: #0000BB">$mem </span><span style="color: #007700">= new </span><span style="color: #0000BB">SyncSharedMemory</span><span style="color: #007700">(</span><span style="color: #DD0000">"AppReportName"</span><span style="color: #007700">, </span><span style="color: #0000BB">1024</span><span style="color: #007700">);<br />if (</span><span style="color: #0000BB">$mem</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">first</span><span style="color: #007700">())<br />{<br />    </span><span style="color: #FF8000">// Do first time initialization work here.<br /></span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB">$result </span><span style="color: #007700">= </span><span style="color: #0000BB">$mem</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">write</span><span style="color: #007700">(</span><span style="color: #0000BB">json_encode</span><span style="color: #007700">(array(</span><span style="color: #DD0000">"name" </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">"my_report.txt"</span><span style="color: #007700">)));<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-syncsharedmemory.construct-seealso">
  <h3 class="title">Прогляньте також</h3>
  <ul class="simplelist">
   <li><span class="methodname"><a href="syncsharedmemory.first.php" class="methodname" rel="rdfs-seeAlso">SyncSharedMemory::first()</a> - Check to see if the object is the first instance system-wide of named shared memory</span></li>
   <li><span class="methodname"><a href="syncsharedmemory.size.php" class="methodname" rel="rdfs-seeAlso">SyncSharedMemory::size()</a> - Returns the size of the named shared memory</span></li>
   <li><span class="methodname"><a href="syncsharedmemory.write.php" class="methodname" rel="rdfs-seeAlso">SyncSharedMemory::write()</a> - Copy data to named shared memory</span></li>
   <li><span class="methodname"><a href="syncsharedmemory.read.php" class="methodname" rel="rdfs-seeAlso">SyncSharedMemory::read()</a> - Copy data from named shared memory</span></li>
  </ul>
 </div>


</div><?php manual_footer($setup); ?>