From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: thread safe functions Date: Tue, 24 May 2011 22:57:56 +0200 Message-ID: References: <20100805112743.GA1671@securactive.net> <8C8EEFE6-77CA-42E7-A2FB-9CEF4E83CDFF@raeburn.org> <5105E811-5A0E-4D7B-9A4A-D3DABB12406F@raeburn.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1306270693 31776 80.91.229.12 (24 May 2011 20:58:13 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 24 May 2011 20:58:13 +0000 (UTC) Cc: guile-devel Development To: Ken Raeburn Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue May 24 22:58:09 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QOyg4-0004HR-LZ for guile-devel@m.gmane.org; Tue, 24 May 2011 22:58:08 +0200 Original-Received: from localhost ([::1]:45570 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOyg4-0001Nl-CL for guile-devel@m.gmane.org; Tue, 24 May 2011 16:58:08 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:58401) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOyg0-0001NU-L1 for guile-devel@gnu.org; Tue, 24 May 2011 16:58:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QOyfz-0004Na-2q for guile-devel@gnu.org; Tue, 24 May 2011 16:58:04 -0400 Original-Received: from a-pb-sasl-sd.pobox.com ([64.74.157.62]:52614 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOyfy-0004NW-VV for guile-devel@gnu.org; Tue, 24 May 2011 16:58:03 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 2EFCF5B71; Tue, 24 May 2011 17:00:10 -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=7Ov9Fpc8WjbUXODNQLl1Ih8AHSY=; b=wI4IfF aA2TkiW3YsR9hVi0lxyxt9jmN+05/evLJFkEYx9TUFp6lbTxpbYH6ThgAuGm5i9w pxJ0bOCN/sngerzYKlN373j/KUEya5vqOEgA+Clpm7nIideOXWqk5o9z/3ZgRUCD dFrzuEMZde7j5pWGl2xe8odJSlD3Gd9ijRE0A= 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=TXEe8vPNiFFxlUaAaaCRr1vf73Nml8ga jHTJCadK5YFoOzhnZTZ0qdcBtbuRyJZUumdE1YJSydgkpjvM47yRkGkH5+nMA1Kc UhxlwPOgCd57Mk7znG+UP/xZfNVX2k2caq/XnZfSoMNyFaYJVXu4d04rS1JiKSZ6 I00Enz9y6es= Original-Received: from a-pb-sasl-sd.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 1D53E5B70; Tue, 24 May 2011 17:00:09 -0400 (EDT) Original-Received: from unquote.localdomain (unknown [90.164.198.39]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id 53A835B6B; Tue, 24 May 2011 17:00:06 -0400 (EDT) In-Reply-To: (Andy Wingo's message of "Thu, 10 Feb 2011 23:19:17 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Pobox-Relay-ID: CF0A1344-8648-11E0-9E97-D6B6226F3D4C-02397024!a-pb-sasl-sd.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 64.74.157.62 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:12534 Archived-At: Hi Ken, You mailed a long time ago with some threadsafety issues and I think I've finally gotten to all of the ones you have mentioned. You made good points regarding memory ordering also, but I'm going to let that slide for now, as it didn't have specific bugs. Should you be motivated to review further, please send separate mails. I know that sounds silly but it looks less daunting that way. On Thu 10 Feb 2011 23:19, Andy Wingo writes: > On Sun 29 Aug 2010 03:33, Ken Raeburn writes: > >> I was starting to look through the port code for this, but got >> distracted by scm_ptobs, a pointer which appears to be dynamically >> reallocated as needed when scm_make_port_type is called. Which means >> every function that reads it should be locking the same mutex used when >> updating it; in this case, that appears to be the generic "critical >> section" stuff, and it looks like we're not doing that. > > Yeah, and it is exported to users of libguile. Fun, no? I added a > comment to the header about its impending deprecation, but that's all I > have time for right now. Actually this bug is still present. >> smob.c: I don't think tramp_weak_map is adequately protected, but I'm >> not certain. Fixed. >> srcprop.c: scm_source_whash isn't protected; it also appears to be >> exposed by the name "source-whash" to Scheme code, which wouldn't be >> able to use a mutex defined and used purely in the C code. Fixed also. >> struct.c: Even calling struct-vtable-name can cause a hash table entry >> to be created, it appears. So that's not thread-safe, never mind the >> call to actually change the name. Fixed to a degree earlier; fixed more definitively now. Happy hacking, Andy -- http://wingolog.org/