Garrett D'Amore wrote:
Oliver Yang wrote:
Garrett D'Amore wrote:
Thomas De Schampheleire wrote:
Hi,
The timeout(9F) manpage says:
"The function called by timeout() must adhere to the same
restrictions as a driver soft interrupt handler.
The function called by timeout() is run in interrupt context
and must not sleep or call other functions that might sleep."
Does this mean that a function which is called using a timeout, cannot
use mutex_enter() ?
No. But you should not call cv_wait, or its brethren.
You should not attempt to acquire a lock which will be held by other
functions calling cv_wait, or its brethren. (There are ways to do
that safely, but it requires a fair bit of effort to make sure you
do it safely.)
Maybe above statements could be added in the man page?
Since timeout is a public API, new driver developers might run into
this situation without knowing the constraint of timeout API. At
least, as a QE engineer, I have encountered this situation before.
Maybe it's worth filing a bug against man page for timeout(9F).
I thought "cannot sleep" pretty much *covered* this case. The problem
is that not everyone understands what "sleep" means, I think.
I can't find the following sentence in my timeout(9F):
"The function called by timeout() is run in interrupt context
and must not sleep or call other functions that might sleep."
Actually, above sentence is wrong, as we mentioned before, mutex_enter
could cause the sleep, but we can use mutex_enter in timeout handler.
Do we have the multi-versions of timeout(9F)? Actually, in my
timeout(9F), I just find it mentioned the timeout() is run in interrupt
context.
# man timeout | grep sleep
Reformatting page. Please Wait... done
# man timeout | grep "soft interrupt handler"
Reformatting page. Please Wait... done
restrictions as a driver soft interrupt handler.
--
Cheers,
----------------------------------------------------------------------
Oliver Yang | [EMAIL PROTECTED] | x82229 | Work from office
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code