Re: interruptible_sleep_on
- From: "tony" <zhangtony@xxxxxxxxxxx>
- Date: 24 Oct 2006 19:58:45 -0700
Hi Vib,
You need write wake_up function in your code, otherwise, how could
the thread in sleep status have the chance to run? You have to wake up
your sleeping thread in somewhere.
Take care,
vib wrote:
Hi there,
I've two threads respectively used for reading from and writing to a
device through device driver. In order to efficiently use the CPU
resources, respected system-level read or write function has the
ability to put the calling thread to sleep. Here are my questions:
For instance in the device driver code below, i) how do I know that the
&ivm_wq_out is referring to the calling thread, READThread?
Device driver:
my_read(..)
{
if ( condition_true )
interruptible_sleep_on(&my_wq_out);
}
similar, ii) how do I know that the &my_wq_in is referring to the
calling thread, WRITEThread.
my_write(..)
{
if ( condition_true )
interruptible_sleep_on(&my_wq_in);
}
User application:
READThread(void)
{
while(1)
{
..
read(fd, buf, len);
..
}
WRITEThread(void)
{
while(1)
{
..
write(fd, buf, len);
..
}
Thanks in advance. Very appreciate your comments.
vib
.
- References:
- interruptible_sleep_on
- From: vib
- interruptible_sleep_on
- Prev by Date: Re: Running out of CF disk space
- Next by Date: Re: Is it safe to call wake_up() from interrupt context?
- Previous by thread: Re: interruptible_sleep_on
- Next by thread: Driver installation
- Index(es):
Relevant Pages
|