From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.user Subject: Re: thread safe functions Date: Wed, 18 Aug 2010 08:56:15 -0700 Message-ID: References: <20100805112743.GA1671@securactive.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1282146799 8474 80.91.229.12 (18 Aug 2010 15:53:19 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 18 Aug 2010 15:53:19 +0000 (UTC) Cc: guile-user@gnu.org To: Cedric Cellier Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Aug 18 17:53:18 2010 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Olkx3-0007MU-Oo for guile-user@m.gmane.org; Wed, 18 Aug 2010 17:53:18 +0200 Original-Received: from localhost ([127.0.0.1]:56828 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Olkx3-0004Qs-9k for guile-user@m.gmane.org; Wed, 18 Aug 2010 11:53:17 -0400 Original-Received: from [140.186.70.92] (port=53377 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Olkwx-0004Pk-VU for guile-user@gnu.org; Wed, 18 Aug 2010 11:53:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Olkww-0007u7-IX for guile-user@gnu.org; Wed, 18 Aug 2010 11:53:11 -0400 Original-Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:39486 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Olkww-0007ty-FQ for guile-user@gnu.org; Wed, 18 Aug 2010 11:53:10 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id C2E56CE090; Wed, 18 Aug 2010 11:53:09 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=w24tfdjVi3W/dTMZM5bpIBAdlwI=; b=ZgtKh1 dzEWqW5ASqs5jDGkwBKeGgXBmP1ubuq4eLFG/ZSNaqoyWEDQ41wRakktni9UffLu HFsUTtyawU6L1UkffEUA4kE0tDUOkY86QiYyAfmM6rZT+Gv9ivNIbgTNe91LDIJu 12E5MAcaoXF6VD4rh0NwTpKMJ9Msgpkod25w8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=lhA/gNYhpiEFeO50o/bfyjv108roey7V S2cAZDhvzOzaCUAcxMSThTk64SKP5Yn5pK1AOfSdn/Wi6grXTHvoNxYRygNJtIM2 em4SMUytbX5x5If4QJkjFXPAw3TQ/QFcnti+9iyOzte4HtegKei7wiAhrjFplJs4 IFyPy7MxujY= Original-Received: from a-pb-sasl-quonix. (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id B0BD8CE08F; Wed, 18 Aug 2010 11:53:08 -0400 (EDT) Original-Received: from unquote.localdomain (unknown [75.16.62.19]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id 20467CE08E; Wed, 18 Aug 2010 11:53:06 -0400 (EDT) In-Reply-To: <20100805112743.GA1671@securactive.net> (Cedric Cellier's message of "Thu, 5 Aug 2010 13:27:43 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Pobox-Relay-ID: B267F6C8-AAE0-11DF-A009-9056EE7EF46B-02397024!a-pb-sasl-quonix.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:8078 Archived-At: Hi Cedric, On Thu 05 Aug 2010 04:27, Cedric Cellier writes: > Is there somewhere a list of guile functions that are (/are not) thread > safe ? > > I ask since this morning I was after a strange bug because I was using > the format module in two different thread, then learnt that these > functions are not reentrant. I'm also interrested in the thread-safeness > of gc-stats function. >From "Multi-Threading" in the manual: All libguile functions are (intended to be) robust in the face of multiple threads using them concurrently. This means that there is no risk of the internal data structures of libguile becoming corrupted in such a way that the process crashes. A program might still produce nonsensical results, though. Taking hashtables as an example, Guile guarantees that you can use them from multiple threads concurrently and a hashtable will always remain a valid hashtable and Guile will not crash when you access it. It does not guarantee, however, that inserting into it concurrently from two threads will give useful results: only one insertion might actually happen, none might happen, or the table might in general be modified in a totally arbitrary manner. (It will still be a valid hashtable, but not the one that you might have expected.) Guile might also signal an error when it detects a harmful race condition. Thus, you need to put in additional synchronizations when multiple threads want to use a single hashtable, or any other mutable Scheme object. If you see any problem in libguile regarding threads, you should certainly report it to bug-guile@gnu.org (no subscription required). The same goes for Scheme code. If you have found something in `format' that is not thread-safe, do let us know. Thanks, Andy -- http://wingolog.org/