I am back with a new query.
I have an application which has multiple threads performing write() to USB drive simultaneously.
May be around 32 writer threads will be there and they are getting write requests from a list.
There will always be (KB or MB sized) writes going on. At the time of stopping the application, writer threads need to complete
their pending writes in the list and get terminated.
At an instant, I need to stop the application and I send signal to these threads. When the writers started
performing pending write operations in the list, i just removed the USB drive.
Now I have a strange observation. The writer threads are blocked on /devb/umass. The signal is not hitting
the writer threads and also I am not getting error in write() call. The application is not stopped because the writers are not stopped.
How can I stop the writer threads gracefully? I mean, if the USB is removed after stop, let them exit without
completing pending writes. Could you please share your thoughts on this?