Re: current_task() in start() , stop(), thread differs
Re: current_task() in start() , stop(), thread differs
- Subject: Re: current_task() in start() , stop(), thread differs
- From: Brian Bergstrand <email@hidden>
- Date: Fri, 28 Jan 2005 13:34:38 -0600
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Jan 28, 2005, at 11:44 AM, Parav Pandit wrote:
> 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.
HTH.
Brian Bergstrand <http://www.bergstrand.org/brian/>, AIM: triryche206
PGP Key: <http://www.bergstrand.org/brian/misc/public_key.txt>
MCSE - Must Consult Someone Experienced
As of 01:29:00 PM, iTunes is playing "Guilt On Skin" from "The Dying
Daylights" by "Charon"
-----BEGIN PGP SIGNATURE-----
Version: PGP 8.1
iQA/AwUBQfqFzHnR2Fu2x7aiEQKoJgCfSJrVKnVmjU20JhLm9XvbxbnZAv8AoP2X
nKwJijjcOy99p3m1nhO5MHbN
=jy+U
-----END PGP SIGNATURE-----
_______________________________________________
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