Re: Threading and Synchronization in Mass storage driver
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Hi Herb, Sorry Herb. Now I am replying to the old thread. I am actually implementing a threading and synchronization mechanism for accessing a request queue which is a queue of write data structure having singly linklist. I am creating kernel threads in my init() driver function. These threads access the request queue paralelly by using IOKit's IOLock synchronization primitives. Each thread acquire the lock calling IOLockLock() function and check the request queue whether it is empty or not. If the request queue is empty then the thread release the lock by calling IOLockUnLock() function. So that other threads can access the request queue. After loading the driver, threads get created successfully and each thread goes in a big while loop and the loop goes on infinitely. Now I have to put each thread on a conditional wait. The conditional wait means that if there is no request in the request queue the thread delays for a nanosecond and release the lock from the request queue for that specified time delay, and as soon as the request comes in the request queue, thread wake ups, acquire the lock and process that specified request. Is there any mechanism in IOKit so that I can put the thread on conditional wait ?? After that condition met, wake up that thread to process the specified request ?? Thanks in advance, Yogesh Pahilwan On Wed, 2005-12-07 at 22:01, Herb Petschauer wrote:
Again, this email seems to be a new thread. Why not just reply to the old thread?
Anway: http://developer.apple.com/documentation/Darwin/Conceptual/KernelProgramming...
You will find the entire document enlightening actually :-)
H.
On 07 Dec 2005 18:22:18 +0530, Yogesh P <pahilwan.yogesh@spsoftindia.com> wrote:
Hi Herb,
Thanks for your valuable suggestion about the threading and synchronization in Mac OS X.
I am also thankful to Garth for his suggestions.
Now my driver is not getting crash when I call the IOCreateThread() function.
Is there any API to put the kernel thread in a wait for a nanosecond in sleep in IOKit??
Thanks, Yogesh
_______________________________________________ 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/bogvardi%40gmail.com
This email sent to bogvardi@gmail.com
_______________________________________________ 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)
-
Yogesh P