From jan@swi.psy.uva.nl Wed Sep 26 13:33:28 2001
Received: from gollem.swi.psy.uva.nl (root@gollem [145.18.152.30])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f8QBXSv09043;
	Wed, 26 Sep 2001 13:33:28 +0200 (MET DST)
Received: from localhost (localhost [[UNIX: localhost]])
	by gollem.swi.psy.uva.nl (8.11.2/8.11.2/SuSE Linux 8.11.1-0.5) id f8QBXSa17859;
	Wed, 26 Sep 2001 13:33:28 +0200
From: Jan Wielemaker <jan@swi.psy.uva.nl>
Organization: SWI, University of Amsterdam
To: Николай Федоров <_nicki@mail.ru>,
   "Prolog Mailing List" <prolog@swi.psy.uva.nl>
Subject: Re: [SWIPL] C++ Interface question.
Date: Wed, 26 Sep 2001 13:25:04 +0200
X-Mailer: KMail [version 1.0.29.2]
Content-Type: text/plain
References: <002401c13d7a$de2cb1a0$25a32ec3@unemployed>
In-Reply-To: <002401c13d7a$de2cb1a0$25a32ec3@unemployed>
MIME-Version: 1.0
Message-Id: <01092613332808.15353@gollem>
Content-Transfer-Encoding: 8bit

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

