product.asp
来自「Pthread lib库完整说明文档」· ASP 代码 · 共 548 行 · 第 1/5 页
ASP
548 行
<hr>
<p>Page 256. The comment at line 2 in the <tt>rwlock.h</tt> header example is
incorrect. "Support static initialization of barriers." should be replaced
by "Support static initialization of read-write locks." <br>
<br>
<hr>
<p>Page 278. The <tt>workq_server</tt> routine failed to maintain the
<tt>idle</tt> count. To make room without changing page breaks, I've
compressed two comments, changing line numbers.
<blockquote><pre><tt>
[30] /*
[31] * Server threads exit after waiting 2 seconds.
[32] */
[33] wq->idle++;
[34] status = pthread_cond_timedwait (
[35] &wq->cv, &wq->mutex, &timeout);
[36] wq->idle--;
[37] if (status = ETIMEDOUT) {
[38] DPRINTF (("Worker wait timed out\n"));
[39] timedout = 1;
[40] break;
[41] } else if (status != 0) {
[42] /*
[43] * This should return failure, but that's
[44] * awkward because this routine is running
[45] * asynchronously. Failure is unlikely,
[46] * and I've chosen to avoid that level of
[47] * complication. The server thread will return,
</tt></pre></blockquote>
Note: Line 31 has changed, and the second line of that comment has
been removed. Lines 33 and 36 were added. Lines 43 through 46 have
been rewritten (replacing the original lines 42 through 46).
Intervening lines are identical except in line number. Lines 30 and 47
have not changed and are included here only for context.
<hr>
<p>Page 297. In the last-but-one line of section 8.1.2 before the
8.1.3 heading, a sentence begins "Refer to c<tt>rew.c</tt>, in Section 4.2...".
The "<tt>crew.c</tt>" should be in fixed-pitch font, however the initial
"c" escaped and appears in the normal text font.
<hr>
<p>Page 315. The function "pthread_exit" is shown as "int
pthread_exit", but the "int" should be "void". That is, the prototype
for the function should be:
<blockquote><pre><tt>
void pthread_exit (
void *value_ptr);
</tt></pre></blockquote>
The function pthread_exit() never returns, so prototyping a return
value would be pointless!
<hr>
<p>Page 316. The Hint line under <tt>pthread_self</tt> at the top of
the page is ambiguously short and potentially misleading. Change to:
<blockquote>
Hint: Use to detach or adjust scheduling of calling thread.
</blockquote>
<hr>
<p>Page 327. Since I fixed <tt>pthread_attr_setinheritsched</tt> to mention
contention scope, I ought to fix <tt>pthread_attr_getinheritsched</tt> as
well. Replace the phrase "using the scheduling policy and parameters of the
creator" with "using the scheduling policy, parameters, and contention scope
of the creator".
<br>
<hr>
<p>Page 327. The function <tt>pthread_attr_getschedparam</tt> is designated
as appearing under the POSIX option <tt>_POSIX_THREAD_PRIORITY_SCHEDULING</tt>.
While it's not particularly useful without that option, strictly speaking
this is incorrect: the function is required of any implementation supporting
threads. The notation "<tt>[_POSIX_THREAD_PRIORITY_SCHEDULING]</tt>" in the
leading line, and the string of "." separators that precede it, should be
removed, so that the line appears like this:
<blockquote>
<b>pthread_attr_getschedparam</b>
</blockquote>
<hr>
<p>Page 329. Somewhere between the 3rd printing (which is fine) and the 7th
printing (the next copy I have), most of a paragraph was dropped from the
description of the <tt>pthread_attr_setinheritsched</tt> function. The description
now reads:
<blockquote> change the <i>inheritsched</i> attribute from <tt>PTHREAD_INHERIT_SCHED</tt>
to <tt>PTHREAD_EXPLICIT_SCHED</tt>. The default is implementation defined.
</blockquote>
<p>But in the 3rd printing, this text was preceded by:
<blockquote> Specify whether threads created with <tt>attr</tt> will run using
the scheduling policy and parameters of the creator or those specified in
the attributes object. When you change the scheduling policy or parameters
in a thread attributes object, you must </blockquote>
<p>In looking at it now, I think it's a little odd to tell people to change
it from "inherit" to "explicit" (which happens to be how it'd work on most
implementations) and then tell them that the default is implementation defined.
Also, originally the inheritance of the contention scope wasn't explicitly
attached to <i>inheritsched</i>, and nobody really thought about it. In the
most recent revision of the standard, this has been fixed. So instead of just
restoring the original text, I'd like the paragraph to read:
<blockquote> Specify whether threads created with <tt>attr</tt> will use the
scheduling policy, parameters, and contention scope of the creator or those
specified in the attributes object. When you change the scheduling policy,
parameters, or contention scope in a thread attributes object, you must set
the <i>inheritsched</i> attribute to <tt>PTHREAD_EXPLICIT_SCHED</tt>. The
default value of <i>inheritsched</i> is implementation defined. </blockquote>
<hr>
<p>Page 329. The function <tt>pthread_attr_setschedparam</tt> is designated
as appearing under the POSIX option <tt>_POSIX_THREAD_PRIORITY_SCHEDULING</tt>.
While it's not particularly useful without that option, strictly speaking
this is incorrect: the function is required of any implementation supporting
threads. The notation "<tt>[_POSIX_THREAD_PRIORITY_SCHEDULING]</tt>" in the
leading line, and the string of "." separators that precede it, should be
removed, so that the line appears like this:
<blockquote>
<b>pthread_attr_setschedparam</b>
</blockquote>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?