Re: current_task() in start() , stop(), thread differs
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Hi,
Hi, Please grant me to ask this silly question.
I am creating one thread using IOCreateThread(). I want to do syncronization between this thread and my interrupt handler, which is in the workloop thread.
Currently I create one semaphore using semaphore_create(current_task()) in the start().
Sounds like you have two kernel only threads. If this is the case, you will get undefined behavior from using current_task(), since you are tying the semaphore to a (possibly) transient task. When the task disappears (or gets a signal) the semaphore will make it's way back out to userland and disappear with it. If you are dealing with strictly kernel threads, use the kernel global kernel_task to create the sem. tied to the kernel.
I got your point -when we want to sem_wait(), signal() from kernel only, kernel_task should be owner of this. This global kernel_task, we use for memory mapping from user space to kernel space, via IOMemoryDescriptor. my doubt is, as kextload command is issued, code for start() will be executed in the task context of that kextload ( transient task.) Even though is is kernel code, context of execution will be user initiated task (transient one) and not the kernel task context. Is my understanding correct? Regards, Parav ________________________________________________________________________ Yahoo! India Matrimony: Find your life partner online Go to: http://yahoo.shaadi.com/india-matrimony _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com
participants (1)
-
Parav Pandit