Subject: Re: [SWIPL] C++ Interface question.

From: Jan Wielemaker <[email-masked]>
Date: Wed, 26 Sep 2001 13:25:04 +0200

On Sat, 15 Sep 2001, îÉËÏÌÁÊ æÅÄÏÒÏ× wrote:
>Hi, all.
>
>Can somebody explain me why my program crashes (in libpl.dll module,
>PL_initialize function to be more precisely) when I create 2 PlEngine objects in
>2 different threads (crashes right after creating the second one).

You can only create one PlEngine object.  Currently there is no support
for multithreading in the C++ interface, though I see no reason why the
native-C thread-functions won't work once you've got Prolog itself
compiled for Windows (considering you talk about DLL's I suppose you
use Windows).  Currently however the multithreaded Prolog is based
on POSIX threads that doesn't port so easily (the Windows port of the
POSIX thread library lacks asynchronous inter-thread signals required
for atom garbage collection).

Multiple threads can use the same single-thread engine, as long as they
use a mutex to avoid multiple threads having an open query at the same
time.  I'm sure some people out there have example code for you.

	--- Jan