Re: Yielding the processor in a kext?
Re: Yielding the processor in a kext?
- Subject: Re: Yielding the processor in a kext?
- From: Régis Duchesne <email@hidden>
- Date: Fri, 07 Sep 2007 16:41:57 -0700
Anton,
> Indeed, sched_yield() calls the swtch_pri() system call with zero as
> only argument (the argument is not used by swtch_pri() so it does not
> matter anyway). That in turn is connected to thread_block_reason()
> which you cannot call form a kext but that is called from thread_block()
> which I suggested to you in my previous email so my answer of using
> thread_block(THREAD_CONTINUE_NULL) may well turn out to be a winner here!
I did the same investigation, but came to a different conclusion:
swtch_pri actually uses thread_block_reason(THREAD_CONTINUE_NULL, NULL,
AST_YIELD) and the only difference is that:
1) thread_block_reason is not exported
2) AST_YIELD forces the timeslice of the current thread to 0
So by just using thread_block(), we might not surrender the timeslice.
I'll do some more real-life testing.
--
hpreg
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden