From jan@swi.psy.uva.nl  Mon Jan 31 16:15:10 2000
Received: from gollem.swi.psy.uva.nl (root@gollem [145.18.152.30])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id QAA20740;
	Mon, 31 Jan 2000 16:15:10 +0100 (MET)
Received: from localhost (localhost [[UNIX: localhost]])
	by gollem.swi.psy.uva.nl (8.9.3/8.9.3/SuSE Linux 8.9.3-0.1) id QAA08179;
	Mon, 31 Jan 2000 16:15:19 +0100
From: Jan Wielemaker <jan@swi.psy.uva.nl>
Organization: SWI, University of Amsterdam
To: Andrey Diatchkov <ad@dual.solvo.spb.su>, prolog@swi.psy.uva.nl
Subject: Re: Thread problem in 3.3.0
Date: Mon, 31 Jan 2000 16:13:15 +0100
X-Mailer: KMail [version 1.0.28]
Content-Type: text/plain
References: <Pine.LNX.4.10.10001311652470.13486-100000@dual.solvo.spb.su>
In-Reply-To: <Pine.LNX.4.10.10001311652470.13486-100000@dual.solvo.spb.su>
MIME-Version: 1.0
Message-Id: <00013116151906.32647@gollem>
Content-Transfer-Encoding: 8bit

On Mon, 31 Jan 2000, Andrey Diatchkov wrote:

>main_cycle(LoggerId) :-
>        thread_send_message(LoggerId," first"),
>        thread_send_message(LoggerId," second"),
>	sleep(0.1),
>        !,
>        main_cycle(LoggerId).
>Result:
> first
> first
> first
> first
> . . .

This is indead a bug.  Actually a rather simple one.  Below is
the patch.  This fix will appear in 3.3.0#13.

	Thanks for reporting

		--- Jan

Index: pl-thread.c
===================================================================
RCS file: /usr/local/cvsroot/pl/src/pl-thread.c,v
retrieving revision 1.16
diff -u -w -r1.16 pl-thread.c
--- pl-thread.c	2000/01/29 17:00:52	1.16
+++ pl-thread.c	2000/01/31 15:10:01
@@ -885,7 +885,7 @@
       { if ( prev )
 	  prev->next = msgp->next;
 	else
-	  ld->thread.msg_head = ld->thread.msg_tail = NULL;
+	  ld->thread.msg_head = msgp->next;
 	PL_erase(msgp->message);
 	freeHeap(msgp, sizeof(*msgp));
 	UNLOCK();

