|Did you know ...||Search Documentation:|
|Pooling Prolog engines (many-to-many)|
In this model Prolog engines live as entities that are independent from threads. If a thread needs to call Prolog it takes one of the engines from the pool and returns the engine when done. This model is suitable in the following identified cases:
In the single-threaded version this call always returns
TRUE, on failure the return value is
NULLthe current engine associated with the calling thread is stored at the given location. If engine equals
PL_ENGINE_MAINthe initial engine is attached to the calling thread. If engine is
PL_ENGINE_CURRENTthe engine is not changed. This can be used to query the current engine. This call returns
PL_ENGINE_SETif the engine was switched successfully,
PL_ENGINE_INVALif engine is not a valid engine handle and
PL_ENGINE_INUSEif the engine is currently in use by another thread.
Engines can be changed at any time. For example, it is allowed to
select an engine to initiate a Prolog goal, detach it and at a later
moment execute the goal from another thread. Note, however, that the
fid_t types are
interpreted relative to the engine for which they are created. Behaviour
when passing one of these types from one engine to another is undefined.
In the single-threaded version this call only succeeds if engine refers to the main engine.