Re: Threading and Synchronization in Mass storage driver
Re: Threading and Synchronization in Mass storage driver
- Subject: Re: Threading and Synchronization in Mass storage driver
- From: Yogesh P <email@hidden>
- Date: 08 Dec 2005 18:31:02 +0530
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/services/chapter_16_section_2.html
>
> You will find the entire document enlightening actually :-)
>
> H.
>
> On 07 Dec 2005 18:22:18 +0530, Yogesh P <email@hidden> 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 (email@hidden)
> > Help/Unsubscribe/Update your Subscription:
> >
> > This email sent to email@hidden
> >
_______________________________________________
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