This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
timed select() / timed wait on a CV
- To: ecos-discuss <ecos-discuss at sources dot redhat dot com>
- Subject: [ECOS] timed select() / timed wait on a CV
- From: "Joerg Troeger" <jtroeger at nortelnetworks dot com>
- Date: Wed, 6 Sep 2000 09:54:46 +0100
- Organization: NetServe
- Reply-To: "Joerg Troeger" <jtroeger at nortelnetworks dot com>
If select() is called with a timeout value ,the timed wait routine
of the condition variable 'selwait' is called with locked scheduler.
This routine doesn't respect the current scheduler lock count
which causes some errors:
- it doesn't sleep in wait_inner()
- it clears the sleep timer, which forces an unlimited sleep whenever the
lock count of the scheduler lock goes zero
- it acquires the mutex lock before actually sleeping in select(),
which prevents other threads to be awoken from select().
Adding a check of a variable "current_lock" corrects this behaviour.
Compare the untimed version (mutex.cxx, rev. 1.8, comment lines #547-550,
code lines #560-564, #629-631).
Jörg Tröger