semaphore.html
来自「perl教程」· HTML 代码 · 共 144 行
HTML
144 行
<?xml version="1.0" ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<!-- saved from url=(0017)http://localhost/ -->
<script language="JavaScript" src="../../displayToc.js"></script>
<script language="JavaScript" src="../../tocParas.js"></script>
<script language="JavaScript" src="../../tocTab.js"></script>
<link rel="stylesheet" type="text/css" href="../../scineplex.css">
<title>Win32::Semaphore - Use Win32 semaphore objects from Perl</title>
<link rel="stylesheet" href="../../Active.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:" />
</head>
<body>
<script>writelinks('__top__',2);</script>
<h1><a>Win32::Semaphore - Use Win32 semaphore objects from Perl</a></h1>
<p><a name="__index__"></a></p>
<!-- INDEX BEGIN -->
<ul>
<li><a href="#name">NAME</a></li>
<li><a href="#synopsis">SYNOPSIS</a></li>
<li><a href="#description">DESCRIPTION</a></li>
<ul>
<li><a href="#methods">Methods</a></li>
<li><a href="#deprecated_functions_and_methods">Deprecated Functions and Methods</a></li>
</ul>
<li><a href="#author">AUTHOR</a></li>
</ul>
<!-- INDEX END -->
<hr />
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>Win32::Semaphore - Use Win32 semaphore objects from Perl</p>
<p>
</p>
<hr />
<h1><a name="synopsis_require_win32__semaphore_">SYNOPSIS
require Win32::Semaphore;</a></h1>
<pre>
<span class="variable">$sem</span> <span class="operator">=</span> <span class="variable">Win32::Semaphore</span><span class="operator">-></span><span class="variable">new</span><span class="operator">(</span><span class="variable">$initial</span><span class="operator">,</span><span class="variable">$maximum</span><span class="operator">,</span><span class="variable">$name</span><span class="operator">);</span>
<span class="variable">$sem</span><span class="operator">-></span><span class="keyword">wait</span><span class="operator">;</span>
</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>This module allows access to Win32 semaphore objects. The <a href="#item_wait"><code>wait</code></a>
method and <code>wait_all</code> & <code>wait_any</code> functions are inherited from the
<a href="#win32__ipc">Win32::IPC</a> module.</p>
<p>
</p>
<h2><a name="methods">Methods</a></h2>
<dl>
<dt><strong><a name="item_new">$semaphore = Win32::Semaphore->new($initial, $maximum, [$name])</a></strong>
<dd>
<p>Constructor for a new semaphore object. <code>$initial</code> is the initial
count, and <code>$maximum</code> is the maximum count for the semaphore. If
<code>$name</code> is omitted, creates an unnamed semaphore object.</p>
</dd>
<dd>
<p>If <code>$name</code> signifies an existing semaphore object, then <code>$initial</code>
and <code>$maximum</code> are ignored and the object is opened. If this
happens, <a href="../../lib/Pod/perlvar.html#item___e"><code>$^E</code></a> will be set to 183 (ERROR_ALREADY_EXISTS).</p>
</dd>
</li>
<dt><strong><a name="item_open">$semaphore = Win32::Semaphore-><code>open($name)</code></a></strong>
<dd>
<p>Constructor for opening an existing semaphore object.</p>
</dd>
</li>
<dt><strong><a name="item_release">$semaphore->release([$increment, [$previous]])</a></strong>
<dd>
<p>Increment the count of <code>$semaphore</code> by <code>$increment</code> (default 1).
If <code>$increment</code> plus the semaphore's current count is more than its
maximum count, the count is not changed. Returns true if the
increment is successful.</p>
</dd>
<dd>
<p>The semaphore's count (before incrementing) is stored in the second
argument (if any).</p>
</dd>
<dd>
<p>It is not necessary to wait on a semaphore before calling <a href="#item_release"><code>release</code></a>,
but you'd better know what you're doing.</p>
</dd>
</li>
<dt><strong><a name="item_wait">$semaphore-><code>wait([$timeout])</code></a></strong>
<dd>
<p>Wait for <code>$semaphore</code>'s count to be nonzero, then decrement it by 1.
See <a href="#win32__ipc">Win32::IPC</a>.</p>
</dd>
</li>
</dl>
<p>
</p>
<h2><a name="deprecated_functions_and_methods">Deprecated Functions and Methods</a></h2>
<p><strong>Win32::Semaphore</strong> still supports the ActiveWare syntax, but its use
is deprecated.</p>
<dl>
<dt><strong><a name="item_create">Win32::Semaphore::Create($SemObject,$Initial,$Max,$Name)</a></strong>
<dd>
<p>Use <a href="#item_new"><code>$SemObject = Win32::Semaphore->new($Initial,$Max,$Name)</code></a> instead.</p>
</dd>
</li>
<dt><strong><a name="item_open">Win32::Semaphore::Open($SemObject, $Name)</a></strong>
<dd>
<p>Use <a href="#item_open"><code>$SemObject = Win32::Semaphore->open($Name)</code></a> instead.</p>
</dd>
</li>
<dt><strong><a name="item_release">$SemObj-><code>Release($Count,$LastVal)</code></a></strong>
<dd>
<p>Use <a href="#item_release"><code>$SemObj->release($Count,$LastVal)</code></a> instead.</p>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><a name="author">AUTHOR</a></h1>
<p>Christopher J. Madsen <<em><a href="mailto:cjm@pobox.com">cjm@pobox.com</a></em>></p>
<p>Loosely based on the original module by ActiveWare Internet Corp.,
<em><a href="http://www.ActiveWare.com">http://www.ActiveWare.com</a></em></p>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?