Re: Timers in my NKE
Re: Timers in my NKE
- Subject: Re: Timers in my NKE
- From: Matt Jaffa <email@hidden>
- Date: Thu, 17 Jun 2004 15:11:53 -0600
ok,
I got pretty far with the stuff in <kern/thread_call.h>
except I am not familiar with the thread_call stuff, like the function
and everything actually.
Any examples you can provide it you have used this before,
in my NKE the send function that gets attached to each socket will call
this thread under certain conditions,
I would like to use the way that uses the less resources.
Matt
On Jun 17, 2004, at 3:03 PM, Godfrey van der Linden wrote:
G'day Matt,
The problem with IOCreateThread/IOSleep is that you are tying up a lot
of kernel resource to little effect.
<kern/thread_call.h> and BSD's <sys/systm.h> both use a more efficient
model which is to use a shared pool of threads. 'thread_call' has the
advantage that it is efficient to rearm and re-schedule. But timeout
in <sys/systm.h> is better known and fairly easy to use.
Don't worry about either of these APIs going anytime soon.
Godfrey
On Jun 17, , at 13:26, Matt Jaffa wrote:
hmmm I found a pretty good method for accomplishing my purposes,
unless it isn't a good way.
use IOCreateThread to create the thread and run it,
then inside the thread function I call IOSleep(timetosleep);
then so the work after the thread wakes up.
If I read correctly these are just wrappers for the mach_threads, and
I guess IOKit knows threads better to me, so I will let that API take
care of it, as long as this API is going to be staying along time.
I don't really care if the thread wakes up anywhere from 1 to 10000
milliseconds off from what I told it to sleep, so this method should
work for me, unless there is a suggested and recommended way.
Matt
On Jun 17, 2004, at 12:30 PM, Godfrey van der Linden wrote:
G'day Justin,
You are right it is
#include <kern/thread_call.h> // And can be found in xnu/osfmk/kern
It sort of depends on what you want to do with the timeou()t. But
for regularly scheduled timeouts I prefer using thread_call_enter
directly as it is lighter weight and closer to my requirements.
Godfrey
On Jun 17, , at 10:38, Justin Walker wrote:
On Jun 17, 2004, at 10:11, Godfrey van der Linden wrote:
Check out <xnu/kern/thread_call.h>
Huh? I don't find such a file. What about a 'timeout()' call?
_______________________________________________
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.
_______________________________________________
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.
_______________________________________________
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.