From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Gregory Marton Newsgroups: gmane.lisp.guile.bugs Subject: Re: with-timeout and asynchronous alarm (was: signal handling different in 1.8.3 than 1.8.1?) Date: Fri, 18 Jul 2008 09:44:31 -0400 (EDT) Message-ID: References: <87zlp3tlrk.fsf@gnu.org> <871w26dqax.fsf@gnu.org> <87bq0w4rgu.fsf@gnu.org> <87hcaoy0ex.fsf@gnu.org> <49dd78620807171347g2a949cc0x6f25c165d4b41409@mail.gmail.com> <87mykfli53.fsf@gnu.org> <87ljzzbdtb.fsf@gnu.org> Reply-To: Gregory Marton NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Trace: ger.gmane.org 1216388697 23284 80.91.229.12 (18 Jul 2008 13:44:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 18 Jul 2008 13:44:57 +0000 (UTC) Cc: bug-guile@gnu.org To: Ludovic =?iso-8859-1?Q?Court=E8s?= Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Fri Jul 18 15:45:45 2008 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KJqHC-00039w-7X for guile-bugs@m.gmane.org; Fri, 18 Jul 2008 15:45:38 +0200 Original-Received: from localhost ([127.0.0.1]:49869 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KJqGJ-0005Jk-L4 for guile-bugs@m.gmane.org; Fri, 18 Jul 2008 09:44:43 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KJqGE-0005Il-Qh for bug-guile@gnu.org; Fri, 18 Jul 2008 09:44:38 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KJqGD-0005Hj-4s for bug-guile@gnu.org; Fri, 18 Jul 2008 09:44:37 -0400 Original-Received: from [199.232.76.173] (port=40621 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KJqGC-0005Hg-UC for bug-guile@gnu.org; Fri, 18 Jul 2008 09:44:36 -0400 Original-Received: from outgoing.csail.mit.edu ([128.30.2.149]:46317) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KJqG7-0006RS-J9; Fri, 18 Jul 2008 09:44:31 -0400 Original-Received: from ashmore.csail.mit.edu ([128.30.44.32]) by outgoing.csail.mit.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1KJqG7-0006KD-7U; Fri, 18 Jul 2008 09:44:31 -0400 Original-Received: from gremio (helo=localhost) by ashmore.csail.mit.edu with local-esmtp (Exim 4.63) (envelope-from ) id 1KJqG7-0007gP-3B; Fri, 18 Jul 2008 09:44:31 -0400 In-Reply-To: <87ljzzbdtb.fsf@gnu.org> X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:3943 Archived-At: Hi Ludo', Sorry for reading more into your words than was intended. > At a minimum, we could provide a Scheme primitive to allow users to > explicitly ask system asyncs to run (and that's just a few lines of C to > add). What do you think? If it's easy, a "force-asyncs" may be useful in general. I worry first that it is a sort of representation exposure, and that the promise (they'll get run very soon) should be good enough. More importantly, short of a busy-wait loop, I don't see how it would help the alarm case. Where would I invoke it? The common case is something like (with-timeout 60 (lambda () (http-get "http://some.url/")) (lambda () (throw 'server-timeout))) which boils down to (alarm 60) (block-waiting-for-input inet-port) which in testing I chose to simulate as: (alarm 60) (sleep 100) In both the blocking and the sleep case, even a busy wait feels like it would want to run in a separate thread or something, constantly calling force-asyncs. In the blocking case, perhaps there are games to play with select but that forces the code to be timed out to cooperate. If someone didn't write their library with this in mind... I haven't written much multithreaded code, and none in guile, so I'm probably misunderstanding something. How would force-asyncs help? Many thanks, Grem > Hi, > > Gregory Marton writes: > >>> As I suggested earlier [0], I think it's just a matter of >>> non-determinism: there's no guarantee as to when system asyncs are run. >> >> And as I suggested earlier, I think it is very valuable to have >> guarantees about when alarms in particular are handled -- that being >> what they're for. > > Yes, I understand the rationale---and sorry if my message sounded harsh! > > At a minimum, we could provide a Scheme primitive to allow users to > explicitly ask system asyncs to run (and that's just a few lines of C to > add). What do you think? > > Ludo'. > > > > -- ------ __@ Gregory A. Marton http://csail.mit.edu/~gremio/ --- _`\<,_ . -- (*)/ (*) A programming language is a very dangerous data structure. ~~~~~~~~~~~~~~~~-~~~~~~~~_~~~_~~~~~v~~~~^^^^~~~~~--~~~~~~~~~~~~~~~++~~~~~~~