cancelling pending/blocking reads/writes
I'm writing a driver for a custom hardware widget. It's a character device. I'd like to have the file acessed by multiple threads with one of the threads blocking on a read. Is there some way, from the main task, to have that blocking read complete when either I:
-send some ioctl to the fd
-close the fd
Ideally I'd like to have this read thread waiting for data to come in while another thread is either doing writes or ioctls (out of band signaling) and then when someone decides to shut things down, have that thread with the read complete (EBADF? or something like that) to indicate to the thread that it should exit.
Can I just have the ioctl pull the exclusive reader off the wait queue, returning some unique error? Or will a close from one thread cause that read to complete without any action on my part?