Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to wake up a process by pid?



On Sep 29, 2007, at 10:50 AM, Vishal Shetye wrote
Hi all,
I’m facing problem synchronizing threads in my kext.

I have a thread ‘A’ waiting on an event, I’m using assert_wait() and thread_block() for the purpose.
What other thread ‘B’ has is pid of ‘A’.
B should wake A and then A should continue normally.


I tried doing something like, use pfind() or proc_findref() to get proc_t and then use psignal with SIGCONT,
For some reason this doesn’t seem to work.


I’m using x86 intel based mac pro, with osx10.4. is there something I’m missing or is it something specific to intel based macs

You are missing something. Unless you specify THREAD_ABORTSAFE instead of THREAD_UNINT, signals will not get delivered nor will they wake up the thread block.


Also, you should probably not be using signals; if you are going to go to the trouble of using Mach primitives instead of sleep()/msleep() (the BSD layer mechanisms for blocking synchronization), then you should do this by task, not by process.

Alternately, you could use sleep()/msleep() instead, and use signals (be sure you OR PCATCH int pri).

Note that going this route, msleep() is the preferred API; sleep() is in the unsupported symbol set.

-- Terry _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-kernel/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.