So if my thread is not scheduled to be called 5 minutes down the road, what if step 3 is called, So what if thread_call_free(tc) is called before the timeout on the thread, will that cause problems? Matt On Jun 17, 2004, at 3:58 PM, Godfrey van der Linden wrote: There is some pretty simple sample code in xnu/iokit/Kernel/IOTimerEventSource.cpp However in general it is easy to use the thread_call APIs Step 1> tc = thread_call_allocate(...); Step 2> While needed call thread_call_enter(tc, sometimeout); Step 3> thread_call_free(tc) Godfrey On Jun 17, , at 14:15, Matt Jaffa wrote: The reason why I was weary about the thread_call stuff was cause I don't want to have to keep calling thread_call_allocate everytime the thread needs to be called, or do I just allocate it once, say as a global, and allocate it in my Start method and also I guess do the same with the thread_call_function and then in the actual send function that needs to call the thread, then use those global parameters and create the call to the thread, this just seems like so much more work. 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 _______________________________________________ darwin-kernel mailing list | darwin-kernel@lists.apple.com 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 | darwin-kernel@lists.apple.com Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-kernel Do not post admin requests to the list. They will be ignored.
participants (1)
-
Matt Jaffa