This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: waking a thread that's in select()?


On Thu, Sep 28, 2000 at 12:54:52PM -0500, Grant Edwards wrote:

> After some additional debugging, I've discovered that when I
> call cyg_select_abort(), it never sets any bits in select_flag
> because it thinks nobody is waiting on select_flag.  And yet,
> my thread never returns from cyg_select_with_abort().
> 
> The call to cyg_select_abort() is being made from within a web
> server task which is also calling select.  If I move the call
> to cyg_select_abort() to a different thread, then my thread
> _does_ wake up when it's supposed to.

[...]

> I'm going to try to fix this by making my task a higher
> priority than the web server task, so that it goes back to
> sleep on select_flag _before_ the web server calls
> cyg_select_abort().

That makes it work the way I expected.  Its sort of fragile,
but I can't think of a clean way to make cyg_select_abort()
work in the case where there are threads currently in the
middle of a select() that are not currently waiting on
select_flag.  You'd have to have a list of select()ing threads
and another mechanism besides select_flag to tell them to
abort.

It should be noted that cyg_select_abort() is only gauranteed
to abort cyg_select_with_abort() when it occurs in threads of
higher priority than the thread calling syg_select_abort().

-- 
Grant Edwards
grante@visi.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]