product.asp
来自「Pthread lib库完整说明文档」· ASP 代码 · 共 548 行 · 第 1/5 页
ASP
548 行
<P><a href="../content/images/0201633922/sourcecode/sigwait.c">sigwait.c</a></P>
<P><a href="../content/images/0201633922/sourcecode/susp.c">susp.c</a></P>
<P><a href="../content/images/0201633922/sourcecode/thread.c">thread.c</a></P>
<P><a href="../content/images/0201633922/sourcecode/thread_attr.c">thread_attr.c</a></P>
<P><a href="../content/images/0201633922/sourcecode/trylock.c">trylock.c</a></P>
<P><a href="../content/images/0201633922/sourcecode/tsd_destructor.c">tsd_destructor.c</a></P>
<P><a href="../content/images/0201633922/sourcecode/tsd_once.c">tsd_once.c</a></P>
<P><a href="../content/images/0201633922/sourcecode/workq.c">workq.c</a></P>
<P><a href="../content/images/0201633922/sourcecode/workq.h">workq.h</a></P>
<P><a href="../content/images/0201633922/sourcecode/workq_main.c">workq_main.c</a></P>
<P> </P>
<P> </P>
<P> </P>
<P> </P>
</p></div></div><div id="hepm"><div id="bss5"><h3>Errata</h3><p><!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<title>Programming with POSIX Threads errata</title>
</head>
<body>
<h1>
Programming with POSIX Threads errata</h1>
<h4>Corrections for next printing:</h4>
<blockquote>
<p>Page xv. Treading into dangerous waters, this is an update rather
than a "fix", but it seems useful. The second last paragraph on the
page ("As I write this, Sun's Solaris, Digital's Digital UNIX, and SGI's IRIX
already support Pthreads...")
is pretty outdated. Replace with:
<blockquote>
Pthreads interfaces are included with Sun's Solaris; Hewlett-Packard's
Tru64 UNIX, OpenVMS, NonStop platform, and HP-UX; IBM's AIX, OS/400,
and OS/390; SGI's IRIX; SCO's UnixWare; Apple's Mac OS X; and Linux (any
major distribution). There's even an Open Source emulation package
that allows you to use portable Pthread interfaces on Win32 systems.
</blockquote>
<hr>
<p>Page 15. In the <tt>alarm_fork.c</tt> example at the bottom of the
page, line 2 (<tt>#include <wait.h></tt>) should be:
<blockquote><pre><tt>
[2] #include <sys/wait.h>
</tt></pre></blockquote>
<hr>
<p>Page 59. The comment at lines 20 through 23 is incorrect. Where the comment
says "with the mutex locked, to give monitor_thread a reasonable chance of
running", it should say "with the mutex unlocked": </p>
<blockquote>
<pre><tt>
[22] * with the mutex unlocked, to give monitor_thread a reasonable
[23] * chance of running.
</tt></pre>
</blockquote>
<hr>
<p>Page 107. The final paragraph on the page ("The allowed size of a
file name and path name may vary...") is labelled for code example
lines <tt>43-44</tt>. Change that range to <tt>41-42</tt> as the
<tt>path_max</tt> and <tt>name_max</tt> variables have been moved into
the <tt>crew_t</tt> structure. This change (which involves additional
changes on the following pages) resolves a synchronization issue in
the startup sequence of a work crew, and also recognizes that crews
working simultaneously on different file systems might conceivably
need different values. (I could have resolved the synchronization
issue by simply using the system constants <tt>NAME_MAX</tt> and
<tt>PATH_MAX</tt>, but this is more interesting and involves slightly
less change in the code.)
<hr>
<p>Page 108. Replace lines 41 through 44 of the example as follows,
making <tt>path_max</tt> and <tt>name_max</tt> fields of the
<tt>crew_t</tt> structure rather than independent global variables.
<blockquote><pre><tt>
[41] long path_max; /* Filesystem path limit */
[42] long name_max; /* Filesystem name limit */
[43] } crew_t, *crew_p;
[44]
</tt></pre></blockquote>
<hr>
<p>Page 109. The second paragraph, currently labelled <tt>20-23</tt>,
should be moved after the following paragraph, currently labelled
<tt>33-37</tt>. The labels are changed to reflect reordering of the
code segments they describe, as follows. (Only the labels and
paragraph order have changed, but I'm including the full context.)
<blockquote><table width="90%" nosave>
<tr nosave>
<td valign=top nosave><tt>22-26</tt></td>
<td nosave>This condition variable loop blocks each new crew member
until work is made available.</td>
</tr>
<tr nosave>
<td valign=top nosave><tt>40-43</tt></td>
<td nosave>POSIX is a little ambiguous about the actual size of the
<tt>struct dirent</tt> type. The actual requirement for
<tt>readdir_r</tt> is that you pass the address of a buffer large
enough to contain a <tt>struct dirent</tt> with a name member of at
least <tt>NAME_MAX</tt> bytes. TO ensure that we have enough space,
allocate a buffer the size of the system's <tt>struct dirent</tt> plus
the maximum size necessary for a file name on the file system we're
using. This may be bigger than necessary, but it hopefully won't be too
small.</td>
</tr>
</table></blockquote>
<hr>
<p>Page 110. The allocation of the <tt>struct dirent</tt> is deferred
until the work crew is started, because that operation now determines
the correct size. This involves moving the current lines 14 through 24
<i>after</i> the current lines 25 through 44. Aside from this
reorganization, the only change is to the old line 21 (new line 41),
where the reference to the global <tt>name_max</tt> variable becomes
<tt>crew->name_max</tt>.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?