From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Linas Vepstas" Newsgroups: gmane.lisp.guile.devel Subject: Using define in multiple threads? Date: Sun, 16 Nov 2008 16:27:20 -0600 Message-ID: <3ae3aa420811161427t6b2c65d1q4adcd6e9a5689ddc@mail.gmail.com> Reply-To: linasvepstas@gmail.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1226874459 19907 80.91.229.12 (16 Nov 2008 22:27:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 16 Nov 2008 22:27:39 +0000 (UTC) To: guile-devel Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sun Nov 16 23:28:41 2008 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1L1q6h-0006xx-Os for guile-devel@m.gmane.org; Sun, 16 Nov 2008 23:28:40 +0100 Original-Received: from localhost ([127.0.0.1]:59300 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L1q5Z-0002cm-8C for guile-devel@m.gmane.org; Sun, 16 Nov 2008 17:27:29 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L1q5U-0002ch-BX for guile-devel@gnu.org; Sun, 16 Nov 2008 17:27:24 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L1q5S-0002cV-0f for guile-devel@gnu.org; Sun, 16 Nov 2008 17:27:23 -0500 Original-Received: from [199.232.76.173] (port=53193 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L1q5R-0002cS-R8 for guile-devel@gnu.org; Sun, 16 Nov 2008 17:27:21 -0500 Original-Received: from an-out-0708.google.com ([209.85.132.240]:19670) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1L1q5R-0000ty-Or for guile-devel@gnu.org; Sun, 16 Nov 2008 17:27:21 -0500 Original-Received: by an-out-0708.google.com with SMTP id c38so949322ana.21 for ; Sun, 16 Nov 2008 14:27:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to :to:subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=fd3SdN4ywBhxh2KY3AqzZd9HVGcIPuK5haBqZUm+R38=; b=ffiPz7PAhMQy97vbB3izQp8YOTDM8thduBd1OZP4ISUfHjhWBTsCq7d+0Y2IMElGi/ jUju6K/NYToxwhFzcAANFjcyLYo+ljcrMJQSB7fv+aD3V27V2yuBOUjrd0ebEzvcagFa 4kgyNICpN5tCOus8f6PF2q5U0IjGInDOArlH8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=fkj8kAsI7PQma0/nG1wvHy5mvrbsPSUk+BBD1BkhTNfqDNksEJmWapSSTRpxHe++fv +12UYQLz4I1HjnCQb6LwHzECHze1yChY20umo/c4S4xno8h4XIJD6XIgzwAUHkxRWfz1 G9OTmJ7LwSib8kpYqXx9CgHpJI+4mcRxiWxEw= Original-Received: by 10.100.173.18 with SMTP id v18mr1374714ane.17.1226874440977; Sun, 16 Nov 2008 14:27:20 -0800 (PST) Original-Received: by 10.100.249.18 with HTTP; Sun, 16 Nov 2008 14:27:20 -0800 (PST) Content-Disposition: inline X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:7851 Archived-At: Is it "safe" or "legal" to use define in multiple threads? I am currently looking at an infinite loop in guile, it looks like there's a pair with cdr pointing to itself. The pair is a hashtable bucket. I'm reading through hashtab.c and see no locking at all, and so it seems probable that this circular bucket list was created in a race between two threads inserting into the same hash table. Now, the test case which triggers this does nothing other than defines -- it loads a set of files, one per thread, and, for good measure, I reloaded these over and over. So typically, one will have the same function being redefined over and over, typically in different threads. The same function might be getting defined "simultaneously" in different threads, even. So-- I was assuming that this would be an inherently "safe" operation ... but maybe its not? Is there some funky semantics to define in a multi-threaded environment? --linas