From scsh-users-request@scsh.net Thu Jun 1 05:09:02 2006 Return-Path: X-Original-To: scsh@informatik.uni-tuebingen.de Delivered-To: scsh@informatik.uni-tuebingen.de Received: from localhost (loopback [127.0.0.1]) by mx1.informatik.uni-tuebingen.de (Postfix) with ESMTP id 6059D126; Thu, 1 Jun 2006 05:09:00 +0200 (DFT) Received: from mx1.informatik.uni-tuebingen.de ([127.0.0.1]) by localhost (mx1 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 36170-05; Thu, 1 Jun 2006 05:08:57 +0200 (DFT) Received: from www.scsh.net (bernard.Informatik.Uni-Tuebingen.De [134.2.12.122]) by mx1.informatik.uni-tuebingen.de (Postfix) with ESMTP id 3B5CC155; Thu, 1 Jun 2006 05:08:56 +0200 (DFT) Received: by www.scsh.net (Postfix, from userid 3123) id 1E5555ED1; Thu, 1 Jun 2006 05:08:55 +0200 (MST) Old-Return-Path: X-Original-To: scsh-users@scsh.net Delivered-To: scsh-users@scsh.net DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=lnEHCbLNjJjmihko081xZNtydgDCGQptwA0LACAyCOeJoUp6k/G+lPL7+ogVkO4WW338QW/hDeIh4cTZT/Dtt3n6S0TDInSPPT8PQdaPOGe0Q/KJnLVXdn7kYaQ8eZejMqCX60DsYKS1JANamrC9FK/WFevkp5xmZ6fiqDsafmI= Message-ID: <140e7ec30605312008y41cc90e1h61fa1f470623e296@mail.gmail.com> Date: Thu, 1 Jun 2006 11:08:48 +0800 From: sqweek To: scsh-users@scsh.net Subject: Re: 0.6.5 compilation problem with gcc 4.0.3 In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <140e7ec30605310912h45e36fddg167fea9c88194413@mail.gmail.com> Resent-Message-ID: <2GywV.A.W8.GplfEB@bernard> Resent-From: scsh-users@scsh.net X-Mailing-List: archive/latest/327 X-Loop: scsh-users@scsh.net List-Post: List-Help: List-Subscribe: List-Unsubscribe: Precedence: list Resent-Sender: scsh-users-request@scsh.net List-Id: List-Archive: Resent-Date: Thu, 1 Jun 2006 05:08:55 +0200 (MST) On 01/06/06, Martin Gasbichler wrote: > sqweek writes: > > > I moved the write_integer prototype outside the ps_write_integer > > function body and it went and compile happily. Best guess is that gcc > > is misinterpreting the intent of the static keyword in this context as > > a persistant variable instead of a symbol local to the compilation > > unit? > > This problem has been fixed in the latest version of scsh > (0.6.7). It's available from . Argh, I should check this kind of thing. Sorry for the line noise. From scsh-users-request@scsh.net Tue Jun 27 09:44:39 2006 Return-Path: X-Original-To: scsh@informatik.uni-tuebingen.de Delivered-To: scsh@informatik.uni-tuebingen.de Received: from localhost (loopback [127.0.0.1]) by mx1.informatik.uni-tuebingen.de (Postfix) with ESMTP id 5E09B18F; Tue, 27 Jun 2006 09:44:38 +0200 (DFT) Received: from mx1.informatik.uni-tuebingen.de ([127.0.0.1]) by localhost (mx1 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 51310-02; Tue, 27 Jun 2006 09:44:32 +0200 (DFT) Received: from www.scsh.net (bernard.Informatik.Uni-Tuebingen.De [134.2.12.122]) by mx1.informatik.uni-tuebingen.de (Postfix) with ESMTP id BADB710C; Tue, 27 Jun 2006 09:44:30 +0200 (DFT) Received: by www.scsh.net (Postfix, from userid 3123) id 82E3F5ED1; Tue, 27 Jun 2006 09:44:29 +0200 (MST) Old-Return-Path: X-Original-To: scsh-users@scsh.net Delivered-To: scsh-users@scsh.net From: Mitchell Wand To: scsh-users@scsh.net Subject: Report from R6RS Editors Committee X-Mailer: VM 7.18 under Emacs 21.3.1 Sender: Mitchell Wand Date: Mon, 26 Jun 2006 22:54:02 +0200 (MST) Message-ID: User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.5-b27 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: Resent-From: scsh-users@scsh.net X-Mailing-List: archive/latest/328 X-Loop: scsh-users@scsh.net List-Post: List-Help: List-Subscribe: List-Unsubscribe: Precedence: list Resent-Sender: scsh-users-request@scsh.net List-Id: List-Archive: Resent-Date: Tue, 27 Jun 2006 09:44:29 +0200 (MST) I am pleased to announce that an updated comprehensive status report from the R6RS editors is now available at www.schemers.org . For the Steering Committee, --Mitch Wand From scsh-users-request@scsh.net Wed Jun 28 08:46:13 2006 Return-Path: X-Original-To: scsh@informatik.uni-tuebingen.de Delivered-To: scsh@informatik.uni-tuebingen.de Received: from localhost (loopback [127.0.0.1]) by mx4.informatik.uni-tuebingen.de (Postfix) with ESMTP id CEEDF142D; Wed, 28 Jun 2006 08:46:10 +0200 (DFT) Received: from mx4.informatik.uni-tuebingen.de ([127.0.0.1]) by localhost (mx4 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 43854-02; Wed, 28 Jun 2006 08:46:06 +0200 (DFT) Received: from www.scsh.net (bernard.Informatik.Uni-Tuebingen.De [134.2.12.122]) by mx4.informatik.uni-tuebingen.de (Postfix) with ESMTP id 22E9C1445; Wed, 28 Jun 2006 08:46:04 +0200 (DFT) Received: by www.scsh.net (Postfix, from userid 3123) id 4D13C5ED4; Wed, 28 Jun 2006 08:46:01 +0200 (MST) Old-Return-Path: X-Original-To: scsh-users@scsh.net Delivered-To: scsh-users@scsh.net From: "Emilio Lopes" Sender: lopes.emilio@gmail.com To: scsh-users@scsh.net Subject: add-finalizer! Date: Tue, 27 Jun 2006 12:51:29 +0200 (MST) Message-ID: User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.5-b27 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: Resent-From: scsh-users@scsh.net X-Mailing-List: unarchived X-Loop: scsh-users@scsh.net List-Post: List-Help: List-Subscribe: List-Unsubscribe: Precedence: list Resent-Sender: scsh-users-request@scsh.net List-Id: List-Archive: Resent-Date: Wed, 28 Jun 2006 08:46:01 +0200 (MST) I have here some objects whose creation involves starting external processes. I would like these processes to be properly shut down when the corresponding objects are garbage-collected. So I tried using `add-finalizer!' for this purpose and couldn't get it to work. Here is an example: Welcome to scsh 0.6.7 (RC 1) Type ,? for help. > ,open define-record-types primitives > (define-record-type foo :foo (really-make-foo x) (x foo:x)) > (define bar #f) > (define (make-foo x) (let ((new-foo (really-make-foo x))) (add-finalizer! new-foo (lambda (obj) (set! bar 1))) new-foo)) > (make-foo 43) '#{Foo} > ,collect Before: 10608482 words free in semispace After: 10673414 words free in semispace > bar #f > I was expecting `bar' to be 1 at this point. The same example works as expected under Scheme 48 1.3. Isn't this the way it's supposed to work? Thanks in advance for any insight. Emilio -- Emilio C. Lopes Munich, Germany From scsh-users-request@scsh.net Wed Jun 28 09:09:35 2006 Return-Path: X-Original-To: scsh@informatik.uni-tuebingen.de Delivered-To: scsh@informatik.uni-tuebingen.de Received: from localhost (loopback [127.0.0.1]) by mx1.informatik.uni-tuebingen.de (Postfix) with ESMTP id 8E80A18E; Wed, 28 Jun 2006 09:09:33 +0200 (DFT) Received: from mx1.informatik.uni-tuebingen.de ([127.0.0.1]) by localhost (mx1 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 20136-05; Wed, 28 Jun 2006 09:09:27 +0200 (DFT) Received: from www.scsh.net (bernard.Informatik.Uni-Tuebingen.De [134.2.12.122]) by mx1.informatik.uni-tuebingen.de (Postfix) with ESMTP id 58F851A3; Wed, 28 Jun 2006 09:09:26 +0200 (DFT) Received: by www.scsh.net (Postfix, from userid 3123) id C09765ED3; Wed, 28 Jun 2006 09:09:23 +0200 (MST) Old-Return-Path: X-Original-To: scsh-users@scsh.net Delivered-To: scsh-users@scsh.net To: "Emilio Lopes" Cc: scsh-users@scsh.net Subject: Re: add-finalizer! References: From: Martin Gasbichler Date: Wed, 28 Jun 2006 09:07:22 +0200 In-Reply-To: (Emilio Lopes's message of "Tue, 27 Jun 2006 12:51:29 +0200 (MST)") Message-ID: User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.5-b27 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: Resent-From: scsh-users@scsh.net X-Mailing-List: unarchived X-Loop: scsh-users@scsh.net List-Post: List-Help: List-Subscribe: List-Unsubscribe: Precedence: list Resent-Sender: scsh-users-request@scsh.net List-Id: List-Archive: Resent-Date: Wed, 28 Jun 2006 09:09:23 +0200 (MST) "Emilio Lopes" writes: > I have here some objects whose creation involves starting external > processes. I would like these processes to be properly shut down when > the corresponding objects are garbage-collected. > > So I tried using `add-finalizer!' for this purpose and couldn't get it > to work. Here is an example: > > Welcome to scsh 0.6.7 (RC 1) > Type ,? for help. > > ,open define-record-types primitives > > (define-record-type foo :foo > (really-make-foo x) > (x foo:x)) > > (define bar #f) > > (define (make-foo x) > (let ((new-foo (really-make-foo x))) > (add-finalizer! new-foo > (lambda (obj) > (set! bar 1))) > new-foo)) > > (make-foo 43) > '#{Foo} > > ,collect > Before: 10608482 words free in semispace > After: 10673414 words free in semispace > > bar > #f > > > > I was expecting `bar' to be 1 at this point. The same example works > as expected under Scheme 48 1.3. > > Isn't this the way it's supposed to work? The problem is that NEW-FOO is part of the closure that you pass as the finializer and thus can never be GCed (since the finalizer closure is always alive, NEW-FOO is always alive). You therefore need to re-write your code as follows: Welcome to scsh 0.6.7 (R6RS) Type ,? for help. > ,open define-record-types primitives > (define-record-type foo :foo (really-make-foo x) (x foo:x)) > (define bar #f) > (define (finalize-foo! a-foo) (set! bar 1)) > (define (make-foo x) (let ((new-foo (really-make-foo x))) (add-finalizer! new-foo finalize-foo!) new-foo)) > (make-foo 43) '#{Foo} > ,collect Before: 1204331 words free in semispace After: 1294606 words free in semispace > bar #f [1] > ,collect Before: 1287285 words free in semispace After: 1295642 words free in semispace > bar 1 Your code works as expected in S48 1.3 because S48 1.3 uses a different environment representation where only needed variables are contained in a closure's environment. Footnotes: [1] the finalizer did not run here because the focus object (##) is bound to {Foo} -- Martin From scsh-users-request@scsh.net Wed Jun 28 13:22:32 2006 Return-Path: X-Original-To: scsh@informatik.uni-tuebingen.de Delivered-To: scsh@informatik.uni-tuebingen.de Received: from localhost (loopback [127.0.0.1]) by mx4.informatik.uni-tuebingen.de (Postfix) with ESMTP id 7AD681301; Wed, 28 Jun 2006 13:22:31 +0200 (DFT) Received: from mx4.informatik.uni-tuebingen.de ([127.0.0.1]) by localhost (mx4 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 43990-04; Wed, 28 Jun 2006 13:22:29 +0200 (DFT) Received: from www.scsh.net (bernard.Informatik.Uni-Tuebingen.De [134.2.12.122]) by mx4.informatik.uni-tuebingen.de (Postfix) with ESMTP id 5B55B10DE; Wed, 28 Jun 2006 13:22:27 +0200 (DFT) Received: by www.scsh.net (Postfix, from userid 3123) id 094F05ED1; Wed, 28 Jun 2006 13:22:25 +0200 (MST) Old-Return-Path: X-Original-To: scsh-users@scsh.net Delivered-To: scsh-users@scsh.net From: "Emilio Lopes" Sender: lopes.emilio@gmail.com To: "Martin Gasbichler" Subject: Re: add-finalizer! Cc: scsh-users@scsh.net In-Reply-To: References: Date: Wed, 28 Jun 2006 11:14:31 +0200 (MST) Message-ID: <5164ilmsqu.fsf@informatik.uni-tuebingen.de> User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.5-b27 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <-TWHU.A.YAQ.3YmoEB@bernard> Resent-From: scsh-users@scsh.net X-Mailing-List: unarchived X-Loop: scsh-users@scsh.net List-Post: List-Help: List-Subscribe: List-Unsubscribe: Precedence: list Resent-Sender: scsh-users-request@scsh.net List-Id: List-Archive: Resent-Date: Wed, 28 Jun 2006 13:22:25 +0200 (MST) On 28/06/06, Martin Gasbichler wrote: > The problem is that NEW-FOO is part of the closure that you pass as > the finializer and thus can never be GCed OK, thanks for explaining the problem. It works beautifully now. > Your code works as expected in S48 1.3 because S48 1.3 uses a > different environment representation where only needed variables are > contained in a closure's environment. This is an interesting information. Thanks again, Martin. -- Emilio C. Lopes Munich, Germany From scsh-users-request@scsh.net Fri Jun 30 08:50:24 2006 Return-Path: X-Original-To: scsh@informatik.uni-tuebingen.de Delivered-To: scsh@informatik.uni-tuebingen.de Received: from www.scsh.net (bernard.Informatik.Uni-Tuebingen.De [134.2.12.122]) by mx4.informatik.uni-tuebingen.de (Postfix) with ESMTP id 8074413EC; Fri, 30 Jun 2006 08:50:20 +0200 (DFT) Received: by www.scsh.net (Postfix, from userid 3123) id 54DAC5ECF; Fri, 30 Jun 2006 08:50:18 +0200 (MST) Old-Return-Path: X-Original-To: scsh-users@scsh.net Delivered-To: scsh-users@scsh.net From: "Emilio Lopes" Sender: lopes.emilio@gmail.com To: scsh-users@scsh.net Subject: Process forms in finalizers (was: add-finalizer!) Date: Thu, 29 Jun 2006 18:07:06 +0200 (MST) Message-ID: User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.5-b27 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: Resent-From: scsh-users@scsh.net X-Mailing-List: unarchived X-Loop: scsh-users@scsh.net List-Post: List-Help: List-Subscribe: List-Unsubscribe: Precedence: list Resent-Sender: scsh-users-request@scsh.net List-Id: List-Archive: Resent-Date: Fri, 30 Jun 2006 08:50:18 +0200 (MST) I encountered an interesting problem when trying to run an external process from a finalizer. I'm writing this message mostly for documenting my experience for others that might try to achieve the same. My first try was the obvious (see my previous e-mail for the whole example): (define (finalize-foo! a-foo) (& (touch "/tmp/huhu") (> 1 "/dev/null") (= 2 1))) This causes Scsh to crash when GCing: > ,collect Before: 10545979 words free in semispace After: 10645034 words free in semispace > 155 / 1548 <- 1580 <- 3864 <- 3871 <- 3880 <- 3915 <- 1607 <- 1108 <- 1604 <- 1108 <- 1314 <- 1284 <- 1108 <- Process scheme exited abnormally with code 123 (BTW, what is the meaning of the funny numbers above?) After somme twiddling I finally came to something that works: (define (finalize-foo! a-foo) (call-with-output-file "/dev/null" (lambda (null-port) (fork (lambda () (dup null-port 1) (dup null-port 2) (exec "/usr/bin/touch" "/tmp/huhu")) #t)))) The crucial factor here is the second argument to `fork', #t. The manual says: The optional boolean argument continue-threads? specifies whether the currently active threads continue to run in the child or not. The default is #f. I guess this has something to do with the collector running in its own thread, but I can't really explain the problem. -- Emilio C. Lopes Munich, Germany From scsh-users-request@scsh.net Fri Jun 30 09:01:52 2006 Return-Path: X-Original-To: scsh@informatik.uni-tuebingen.de Delivered-To: scsh@informatik.uni-tuebingen.de Received: from localhost (loopback [127.0.0.1]) by mx4.informatik.uni-tuebingen.de (Postfix) with ESMTP id 3B8C9139E; Fri, 30 Jun 2006 09:01:50 +0200 (DFT) Received: from mx4.informatik.uni-tuebingen.de ([127.0.0.1]) by localhost (mx4 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 19488-03; Fri, 30 Jun 2006 09:01:47 +0200 (DFT) Received: from www.scsh.net (bernard.Informatik.Uni-Tuebingen.De [134.2.12.122]) by mx4.informatik.uni-tuebingen.de (Postfix) with ESMTP id C98A113DE; Fri, 30 Jun 2006 09:01:40 +0200 (DFT) Received: by www.scsh.net (Postfix, from userid 3123) id 5791C5ED1; Fri, 30 Jun 2006 09:01:38 +0200 (MST) Old-Return-Path: X-Original-To: scsh-users@scsh.net Delivered-To: scsh-users@scsh.net To: "Emilio Lopes" Cc: scsh-users@scsh.net Subject: Re: Process forms in finalizers References: From: Martin Gasbichler Date: Fri, 30 Jun 2006 08:59:37 +0200 In-Reply-To: (Emilio Lopes's message of "Thu, 29 Jun 2006 18:07:06 +0200 (MST)") Message-ID: <3964ijb02u.fsf@informatik.uni-tuebingen.de> User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.5-b27 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <6XRFGD.A.HXU.ZwMpEB@bernard> Resent-From: scsh-users@scsh.net X-Mailing-List: unarchived X-Loop: scsh-users@scsh.net List-Post: List-Help: List-Subscribe: List-Unsubscribe: Precedence: list Resent-Sender: scsh-users-request@scsh.net List-Id: List-Archive: Resent-Date: Fri, 30 Jun 2006 09:01:38 +0200 (MST) "Emilio Lopes" writes: > I encountered an interesting problem when trying to run an external > process from a finalizer. I'm writing this message mostly for > documenting my experience for others that might try to achieve the > same. > > My first try was the obvious (see my previous e-mail for the whole > example): > > (define (finalize-foo! a-foo) > (& (touch "/tmp/huhu") > (> 1 "/dev/null") > (= 2 1))) > > This causes Scsh to crash when GCing: > > > ,collect > Before: 10545979 words free in semispace > After: 10645034 words free in semispace > > 155 / 1548 <- 1580 <- 3864 <- 3871 <- 3880 <- 3915 <- 1607 <- > 1108 <- 1604 <- 1108 <- 1314 <- 1284 <- 1108 <- > Process scheme exited abnormally with code 123 > > (BTW, what is the meaning of the funny numbers above?) The list of numbers is a backtrace of the crash. You can lookup the corresponding procedure names in build/initial.debug. > After somme twiddling I finally came to something that works: > > (define (finalize-foo! a-foo) > (call-with-output-file "/dev/null" > (lambda (null-port) > (fork (lambda () > (dup null-port 1) > (dup null-port 2) > (exec "/usr/bin/touch" "/tmp/huhu")) > #t)))) > > The crucial factor here is the second argument to `fork', #t. The manual says: > > The optional boolean argument continue-threads? specifies whether the > currently active threads continue to run in the child or not. The > default is #f. > > I guess this has something to do with the collector running in its own > thread, but I can't really explain the problem. Yes, the finalizers are running in their own thread and presumably only that thread continued to run in the forked thread. In general, you should not do anything "complicated" in a finalizer because there is not much protection for the execution of a finalizer. It's often much better to write information about the dead objects into a queue and process this queue in a separate thread. -- Martin