Re: why yield?
"William J. Mills" <[email protected]> Mon, 21 Oct 2002 13:37:10 -0700
| Newsgroups | gmane.network.beep.beepcore.c.general |
|---|---|
| Message-ID | <[email protected]> |
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