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