Is there a way to tell if my code is running in a Pengines instance or not?

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

Is there something I can check to tell if I am running inside of a Pengines instance or not?

Call pengine_self/1

1 Like

That call requires a Pid. What would I pass that function from code that is not running in a Pengine instance?

No. THe argument is -Id, which means it unifies Id with the pengine id. If the thread is not a pengine thread this fails.

1 Like

Perfect, thanks.