On Fri, 2018-02-02 at 01:09 +0000, David Nadlinger via Digitalmars-d- learn wrote: > On Thursday, 1 February 2018 at 11:42:32 UTC, Russel Winder wrote: > > The problem is actually a thread blocked in an inotify blocking > > read. As both Steven and yourself have pointed out I am going > > to have to use a timeout to check the state of the application. > > There are better solutions (select/...), But couldn't you in > theory just send a custom signal to the thread (which you > ignore), and then check for the exit flag after the syscall > returned EINTR?
I think I am going to go the (select|poll|epoll) on the file descriptor with a timeout and then the read if that is appropriate or check the input channel for the terminate token if that is appropriate. The question whether to do this in my code or create a "read with timeout" in dinotify > The DInotify wrapper might of course have the retry loop > hardcoded; I didn't check. Dinotify adds the tree monitoring as an extra over the inotify API but U do not see any timeout related things. -- Russel. =========================================== Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Road m: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.uk
signature.asc
Description: This is a digitally signed message part