Re: Deadlock in My KEXT with NKE
Re: Deadlock in My KEXT with NKE
- Subject: Re: Deadlock in My KEXT with NKE
- From: Justin Walker <email@hidden>
- Date: Wed, 11 Feb 2004 18:51:27 -0800
On Wednesday, February 11, 2004, at 06:25 PM, Matt Jaffa wrote:
Ok I tend to not explain what I am doing real well, sorry about that.
Well, your explanation below seems pretty good. Maybe you just need to
write the first message, throw it away, and then write the second one
to send :-}
I don't want to hold the funnel while it is sleeping, but keeping the
state as it was before it slept.
But the most important thing I am trying to do here is make it so that
the Thread is sleeping while work is being done by the daemon so that
it doesn't do a while loop without sleeping in the kernel, here is my
while loop:
[snip]
If I understand what you want correctly, the more-or-less standard way
to do this in the kernel is with a combo of 'sleep' and 'wakeup'. One
thread sets a variable to indicate that it is sleeping. Then it sleeps.
A second thread comes along, does something, sets the variable to
indicate that the reason for sleeping has past, and then does a wakeup
(sleep has a 'wait' channel; wakeup uses that as the 'target' of the
wakeup).
The first thread now takes off running. It should, by rights, check
the variable to assure that it was awakened for the right reason
(spurious wakeups can occur).
If you look at the networking code in the kernel, you will see calls
like sbwait() and sbwakeup(). These implement that kind of scheme,
using sleep and wakeup on socketbuffers. You should also be sure to
use your own channels (generally, an address), so as not to interfere
with other threads.
Regards,
Justin
--
Justin C. Walker, Curmudgeon-At-Large *
Institute for General Semantics | When LuteFisk is outlawed
| Only outlaws will have
| LuteFisk
*--------------------------------------*-------------------------------*
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.