From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Marius Vollmer Newsgroups: gmane.lisp.guile.bugs Subject: Re: no output from ice-9 `format' after `make-thread' Date: 03 Nov 2002 01:00:51 +0100 Sender: bug-guile-admin@gnu.org Message-ID: <87znsrcyj0.fsf@zagadka.ping.de> References: <87d6pn1stf.fsf@blarg.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1036282602 19689 80.91.224.249 (3 Nov 2002 00:16:42 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 3 Nov 2002 00:16:42 +0000 (UTC) Cc: bug-guile@gnu.org Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1888RU-00057K-00 for ; Sun, 03 Nov 2002 01:16:40 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 1888Qi-0007zB-00; Sat, 02 Nov 2002 19:15:52 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 1888CC-0004Xk-00 for bug-guile@gnu.org; Sat, 02 Nov 2002 19:00:52 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 1888C7-0004Wq-00 for bug-guile@gnu.org; Sat, 02 Nov 2002 19:00:50 -0500 Original-Received: from mail.dokom.net ([195.253.8.218]) by monty-python.gnu.org with esmtp (Exim 4.10) id 1888C6-0004WO-00 for bug-guile@gnu.org; Sat, 02 Nov 2002 19:00:47 -0500 Original-Received: from dialin.speedway43.dip237.dokom.de ([195.138.43.237] helo=zagadka.ping.de ident=qmailr) by mail.dokom.net with smtp (Exim 3.32 #2) id 1888Cq-0001ij-00 for bug-guile@gnu.org; Sun, 03 Nov 2002 01:01:32 +0100 Original-Received: (qmail 2620 invoked by uid 1000); 3 Nov 2002 00:00:51 -0000 Original-To: Eric Hanchrow In-Reply-To: <87d6pn1stf.fsf@blarg.net> Original-Lines: 35 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Errors-To: bug-guile-admin@gnu.org X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Bug reports for GUILE, GNU's Ubiquitous Extension Language List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.bugs:549 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.bugs:549 Eric Hanchrow writes: > Invoke the snippet with `guile -s snippet.scm'. Note the total lack > of output. The process exits before it can produce any output. "guile -s" exits as soon as the main thread exits. (The builtin simple-format is probably fast enough to produce output anyway.) Try this: (use-modules (ice-9 threads)) (use-modules (ice-9 format)) (define safe-format (let ((m (make-mutex))) (lambda args (with-mutex m (apply format args))))) (let ((ts (map (lambda (sym) (make-thread (lambda () (sleep (random 4)) (safe-format #t "Hey you: ~A~%" sym)))) (list 'bob 'sam 'huey 'luey 'duey)))) (for-each join-thread ts)) It uses join-thread to wait for the threads to finish. Note also that (ice-9 format) is not thread safe... (which I'm going to fix soonish (when nothing preempts me)). -- GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405 _______________________________________________ Bug-guile mailing list Bug-guile@gnu.org http://mail.gnu.org/mailman/listinfo/bug-guile