This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: waking a thread that's in select()?
On Thu, Sep 28, 2000 at 04:53:26PM +0200, Andrew Lunn wrote:
> > I've got a thread that is doing a select() on a set of sockets
> > (waiting for incoming TCP requests). Is there a way for
> > another thread to wake-up the select()ing thread?
>
> There is a function to break select out. Have a look at the end of
> packanges/net/tcpip/current/src/lib/select.c.
I can't get it to work. I'm trying to figure out why it
doesn't and I've got a question: In _cyg_select(), the call to
cyg_flag_wait() looks like:
// Wait forever (until something happens)
flag = cyg_flag_wait(&select_flag,wait_flag,CYG_FLAG_WAITMODE_OR|CYG_FLAG_WAITMODE_CLR);
If I understand things correctly, the WAITMODE_CLR means that
only a single thread will be woken up by cyg_select_abort()'s
call to cyg_flag_set():
if (cyg_flag_waiting(&select_flag)) {
// Signal any threads doing a 'select()' that I/O may be possible
cyg_flag_setbits(&select_flag, SELECT_ABORT);
}
If I've got multiple threads threads waiting on select_flag,
only one of them will be awakened, right?
--
Grant Edwards
grante@visi.com