Re: why yield?
Doug Royer <[email protected]> Mon, 21 Oct 2002 16:31:12 -0600
| Newsgroups | gmane.network.beep.beepcore.c.general |
|---|---|
| Message-ID | <[email protected]> |
On POSIX system, I think the 'poll()' must do a 'pthread_testcancel()'
and should be ASYNC-SAFE, so perhaps the YIELD() is for non-POSIX
implementations.
William J. Mills wrote:
> I think it has to do with forcing a yield to the other threads in the
> case that the poll grabs the CPU. Not sure though what the specific
> cases are where we needed this. Might be a holdover from previous
> thread/race debuggig or it might be current and needed.
>
> -bill
>
>
>
> On Mon, Oct 21, 2002 at 10:53:12AM -0400, Chris Hanson wrote:
>
>>I am puzzled by the YIELD() in the code below from tcp_bp_listen().
>>(I've edited the code below to remove the win32 conditionalizations.)
>>Can someone explain why there's any reason to YIELD() here? It seems
>>to me that the program simply loops back to poll(), which will block
>>if there isn't any input.
>>
>>----------------------------------------
>> do {
>> int msecs = 5;
>>
>> if (poll(ready, 1, msecs) <= 0)
>> {
>> if (TERMINATE) {
>> return NULL;
>> }
>> YIELD();
>> continue;
>> }
>>----------------------------------------
>>
>>
>>-------------------------------------------------------
>>This sf.net email is sponsored by:ThinkGeek
>>Welcome to geek heaven.
>>http://thinkgeek.com/sf
>>_______________________________________________
>>Beepcore-c-users mailing list
>>[email protected]
>>https://lists.sourceforge.net/lists/listinfo/beepcore-c-users
>
>
>
> -------------------------------------------------------
> This sf.net emial is sponsored by: Influence the future
> of Java(TM) technology. Join the Java Community
> Process(SM) (JCP(SM)) program now.
> http://ad.doubleclick.net/clk;4699841;7576298;k?http://www.sun.com/javavote
> _______________________________________________
> Beepcore-c-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/beepcore-c-users
--
-
Doug Royer Work: (208)612-INET
[email protected] Fax: (866)594-8574
http://INET-Consulting.com Cell: (208)520-4044
http://Royer.com/People/Doug
smime.p7s
(application/x-pkcs7-signature, 4.3 KB) - not displayed