From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Panicz Maciej Godek Newsgroups: gmane.lisp.guile.user Subject: Re: libguile thread safety Date: Sat, 4 Jan 2014 16:01:35 +0100 Message-ID: References: <20140103233407.36382e5f@bother.homenet> <8738l41p8r.fsf@netris.org> <20140104124459.6c604ae1@bother.homenet> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1388847710 17211 80.91.229.3 (4 Jan 2014 15:01:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 4 Jan 2014 15:01:50 +0000 (UTC) Cc: "guile-user@gnu.org" To: Chris Vine Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sat Jan 04 16:01:57 2014 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VzSjc-0005gY-Ow for guile-user@m.gmane.org; Sat, 04 Jan 2014 16:01:56 +0100 Original-Received: from localhost ([::1]:54735 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VzSjc-00034o-CT for guile-user@m.gmane.org; Sat, 04 Jan 2014 10:01:56 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:32854) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VzSjK-00032C-5E for guile-user@gnu.org; Sat, 04 Jan 2014 10:01:38 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VzSjJ-0007hd-8l for guile-user@gnu.org; Sat, 04 Jan 2014 10:01:38 -0500 Original-Received: from mail-pd0-x232.google.com ([2607:f8b0:400e:c02::232]:59690) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VzSjJ-0007hW-0z for guile-user@gnu.org; Sat, 04 Jan 2014 10:01:37 -0500 Original-Received: by mail-pd0-f178.google.com with SMTP id y10so16512441pdj.9 for ; Sat, 04 Jan 2014 07:01:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=wsTMUFyBhprYXZHej0E41ai2wiBUdNoE/w0dNnnu2O4=; b=sWxfAcmHHOv1iBnGf/pQjtU3M7NgyGkcQImw6db4udn8iqOEOziofhGdJ/FTvW2xec 8E4aQpElLZ5dPxykCxSktFYb6yyIxztMiKxFhKSVtI6nb8szzArwqZaggCJo4iW6fgIs FO8YmmF+Ex7uPvpb7yZ8ISIzXpiSEW8TFnBfDIFjQsnz+PsxSdHO7zQUgIrg3enijVcN szOjZazVYvolPseL7O/5rVjr7LD8D+wyzb10vEYpOGaDKVwFg+OwXlgrbPVODn02A6PO zl+cg8GQ/OBE71UhkVoq++BIq9Q4+pTApt5+c06nh3Oy3eGRCuEvproUJbRHcwrlZXLP l8nQ== X-Received: by 10.68.218.3 with SMTP id pc3mr105899667pbc.71.1388847695752; Sat, 04 Jan 2014 07:01:35 -0800 (PST) Original-Received: by 10.68.8.196 with HTTP; Sat, 4 Jan 2014 07:01:35 -0800 (PST) In-Reply-To: <20140104124459.6c604ae1@bother.homenet> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c02::232 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:10972 Archived-At: 2014/1/4 Chris Vine : > There is something even more bizarre than as reported in the exchange > with Maciej. The further test case below prints: > > Hello > 20 > 20 > > I would have expected: > > Hello > 10 > 20 > > It seems as if top level variables in code evaluated by scm_c_eval_string() > are shared between concurrently running threads. Is this really the > intended behaviour (it is a significant and unexpected usability > restriction)? Maciej (I hope that is your first name) can you reproduce > this? Yes, I confirm that the output with my setup is Hello 20 20 It indeed does seem that the threads share their top-level bindings on guile's side, and I suppose that this is the intended behaviour. I think that it can be easily adjusted with scm_eval_string_in_module, i.e. if you provide a separate module for each thread.