利用假期学习apue,第十一章线程控制,代码几处觉得不对阿,上网看了一下似乎没有人提出这个问题
今天终于在作者的官方网站看到了勘误:
= fp->f_next should be fh[idx]
= fp. Actually, I should apologize for this one. I've written this logic (correctly) so many times that I have no good excuse for getting it wrong this time. Same problem occurs again near the top of page
377.
= HASH(fp) at the beginning of
foo_find, fp is undefined at this point. The correct thing to do is to search every hash chain to find a matching ID. Same problem occurs again in the middle of page 377.
看来我的思路还是对的,继续看