Terminating multiple processes

Russel Winder russel at winder.org.uk
Fri Feb 2 14:44:32 UTC 2018


On Thu, 2018-02-01 at 20:13 +0000, Arek via Digitalmars-d-learn wrote:
> 
[…]
> DInitify doesn't cover full capabilities of the inotify API.
> Especially it doesn't utilize newer inotify_init1 syscall and 
> doesn't expose 'select' interface.
> This C++ wrapper may be interesting for you: 
> https://github.com/erikzenker/inotify-cpp
> But I haven't used it.

Hummm… sounds like I need to look to create a pull request to get to
dinotify 0.2.3 or even 0.3.0.

> > > 
[…]
> You may be right. But interrupting the thread is very low level 
> mechanism.
> Eg in Java, it is incorporated into Thread class: thread has 
> method 'interrupt()' which
> sets the flag, and there is property 'isInterrupted()'. Usually 
> your thread code have something like  
> while(!Thread.currentThread().isInterrupted()) { /* do 
> something*/ }
> I would use similar pattern.

I do want to avoid such low-level things, they may be required for
building libraries, but they seem totally the wrong level of concept
for an application.

I am definitely headed to the (select|poll|epoll) on the inotify file
descriptor to get the timeout, and then either read or check the input
channel for termination or an atomic Boolean state variable. Channels
seem most likely since parent threads send a terminating token.


-- 
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/20180202/089aa0f5/attachment.sig>


More information about the Digitalmars-d-learn mailing list