This method is also provided in the single-threaded version of SWI-Prolog, where it returns -2.

C# | Visual Basic | Visual C++ | F# |
public static int PlThreadSelf()
Public Shared Function PlThreadSelf As Integer
public: static int PlThreadSelf()
static member PlThreadSelf : unit -> int

Int32
Returns the integer Prolog identifier of the engine or -1 if the calling thread has no Prolog engine.
Returns the integer Prolog identifier of the engine or -1 if the calling thread has no Prolog engine.
Assembly: SwiPlCs (Module: SwiPlCs.dll) Version: 1.1.60601.0 (1.1.60601.0)