Destroy all Pengine instances without knowing the Pengine IDs?

I’m using: SWI-Prolog version 8.0.2 on Linux 18.04.

Sometimes during development I wind up with quite a few open PEngine instances with the client code that launched them long gone. Is there a command/predicate that will completely wipe out all PEngine instances? I’d like to modify the PEngines web page interface and add a ‘Destroy All’ option to the Admin page.

I looked at all the pengine methods I could see in the help and all I could find is the pengine_destroy call with it’s 1 and 2 argument call signatures. Both of them require a Pengine ID. I want to do a wholesale shutdown of all open instances without knowing the Pengine ID.

Use Pengine.destroy_all(). This normally called if you unload the page. Using Node you’ll have to do that yourself. If Node has some sort of onexit we should probably also call the destroy_all.

On the Prolog side you can use the thread monitor and abort the Pengine thread. Probably this also works:

?- forall(pengine_property(_, thread(T)), thread_signal(T, abort)).
1 Like

Thanks Jan!