On Thu, 2018-02-01 at 12:15 +0000, Arek via Digitalmars-d-learn wrote: > […] > Try to use inotify in non-blocking mode (an example here: > https://gist.github.com/pkrnjevic/6016356) with select or epoll > and timeouts.
Isn't there a C++ binding for the C API? I am using DInotify which is a D binding. I will be checking soon but I am assuming there is a timeout version so I can loop to check the application state. > > > > I guess there is a choice here between shared memory to set the > > termination flag, or using an input channel and sending the > > termination message. I think the latter may be preferable, and > > certainly more consistent with how the other threads terminate. > > > > I would use shared memory here (eg. atomic bool) because any > communication channel introduces possibility of further blocking > problems. A priori I am not convinced. I have used a state variable in C++ and Python code where there is no channel system, but in Go, Groovy/GPars, using channels is always preferable. Given the channel has a "read if there is something to read" there can't be a blocking problem – if the channel system is a good one. -- 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