Terminating multiple processes

Russel Winder russel at winder.org.uk
Thu Feb 1 12:30:24 UTC 2018


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20180201/8edbc4a8/attachment.sig>


More information about the Digitalmars-d-learn mailing list