From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] Fix thread-unsafe lazy initializations Date: Tue, 05 Mar 2013 13:53:00 -0500 Message-ID: <87hakpel0z.fsf@tines.lan> References: <87wqx4w878.fsf@tines.lan> <87vcco5g4j.fsf@gnu.org> <87mwy0vxog.fsf@tines.lan> <877gn62thq.fsf@pobox.com> <87txq7okkj.fsf@tines.lan> <87pq0voiym.fsf@tines.lan> <87mwuow3jx.fsf@tines.lan> <87fw0gvxdj.fsf_-_@tines.lan> <874ngv8odp.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1362509606 30717 80.91.229.3 (5 Mar 2013 18:53:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 5 Mar 2013 18:53:26 +0000 (UTC) Cc: Andy Wingo , guile-devel@gnu.org To: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Mar 05 19:53:50 2013 Return-path: Envelope-to: guile-devel@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 1UCwzj-0006ri-6O for guile-devel@m.gmane.org; Tue, 05 Mar 2013 19:53:47 +0100 Original-Received: from localhost ([::1]:37811 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCwzN-0001Z8-O1 for guile-devel@m.gmane.org; Tue, 05 Mar 2013 13:53:25 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:60041) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCwzI-0001Y0-47 for guile-devel@gnu.org; Tue, 05 Mar 2013 13:53:21 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UCwzF-0002dm-Jn for guile-devel@gnu.org; Tue, 05 Mar 2013 13:53:20 -0500 Original-Received: from world.peace.net ([96.39.62.75]:51423) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCwzF-0002cc-Ef; Tue, 05 Mar 2013 13:53:17 -0500 Original-Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.91.212] helo=tines.lan) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1UCwz7-00039V-3Y; Tue, 05 Mar 2013 13:53:09 -0500 In-Reply-To: <874ngv8odp.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Fri, 01 Mar 2013 10:23:30 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 96.39.62.75 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:15861 Archived-At: Hi Ludovic, ludo@gnu.org (Ludovic Court=C3=A8s) writes: > Mark H Weaver skribis: > >> --- a/doc/ref/api-modules.texi >> +++ b/doc/ref/api-modules.texi >> @@ -942,14 +942,15 @@ the @var{name} is not bound in the module, signals= an error. Returns a >> variable, always. >>=20=20 >> @example >> -SCM my_eval_string (SCM str) >> -@{ >> - static SCM eval_string_var =3D SCM_BOOL_F; >> +static SCM eval_string_var; >>=20=20 >> - if (scm_is_false (eval_string_var)) >> - eval_string_var =3D >> - scm_c_public_lookup ("ice-9 eval-string", "eval-string"); >> +void my_init (void) >> +@{ >> + eval_string_var =3D scm_c_public_lookup ("ice-9 eval-string", "eval-s= tring"); >> +@} >>=20=20 >> +SCM my_eval_string (SCM str) >> +@{ >> return scm_call_1 (scm_variable_ref (eval_string_var), str); >> @} >> @end example > > The doc should say something about =E2=80=98my_init=E2=80=99, and perhaps= mention > locking? Can you suggest some text? 'my_init' seems obvious to me, and given that this is just an example for 'scm_c_*_lookup', it seems out of place to talk about general locking issues here, but feel free to propose some text to go here. Thanks, Mark