From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.user Subject: Re: Can scm_shell be interrupted? Date: Mon, 12 May 2008 21:43:53 +0100 Message-ID: <87prrruuba.fsf@ossau.uklinux.net> References: <200805102254.59603.vrsoft@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1210625114 27186 80.91.229.12 (12 May 2008 20:45:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 12 May 2008 20:45:14 +0000 (UTC) Cc: guile-user@gnu.org To: Remco Bras Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon May 12 22:45:51 2008 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Jvetv-00033O-6Q for guile-user@m.gmane.org; Mon, 12 May 2008 22:45:39 +0200 Original-Received: from localhost ([127.0.0.1]:52721 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JvetC-0000lq-9d for guile-user@m.gmane.org; Mon, 12 May 2008 16:44:54 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JvesH-0000Fq-QI for guile-user@gnu.org; Mon, 12 May 2008 16:43:57 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JvesG-0000FB-AY for guile-user@gnu.org; Mon, 12 May 2008 16:43:57 -0400 Original-Received: from [199.232.76.173] (port=56266 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JvesG-0000F5-17 for guile-user@gnu.org; Mon, 12 May 2008 16:43:56 -0400 Original-Received: from mail3.uklinux.net ([80.84.72.33]:52540) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JvesF-0003BE-Sv for guile-user@gnu.org; Mon, 12 May 2008 16:43:56 -0400 Original-Received: from arudy (host81-129-100-189.range81-129.btcentralplus.com [81.129.100.189]) by mail3.uklinux.net (Postfix) with ESMTP id 2F46D1F6660; Mon, 12 May 2008 21:43:54 +0100 (BST) Original-Received: from laruns (laruns [192.168.0.10]) by arudy (Postfix) with ESMTP id 969533800D; Mon, 12 May 2008 21:43:53 +0100 (BST) In-Reply-To: <200805102254.59603.vrsoft@gmail.com> (Remco Bras's message of "Sat, 10 May 2008 22:54:59 +0200") User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:6565 Archived-At: Remco Bras writes: > Hello, > > I have a question about guile. I'd like to know if it is feasible to run a > guile REPL and control when it runs. For example, consider the following > scenario. A package may or may not have a thread running scm_shell, when the > user requests that the package runs an REPL. The package responds by running > scm_shell in a thread and keeping that thread's ID. If the user wants the > package to stop the REPL at any moment, is there a way to do this safely? Where does the REPL's input come from? If its stdin, being read in a blocking way (as is the default), it would be tricky if the REPL thread did the read directly. But you could have a special stdin-reader thread, responsible for reading and buffering lines of input, and then supplying them to whichever REPL runs next. What happens if the user wants to stop a package's REPL when the user has already typed half a line of input into that REPL? It might also be possible to make stdin non-blocking, and use select to avoid trying to read before there is a whole line available. If its a GUI app, it becomes less a matter of a REPL reading from a port, and more a matter of a widget collecting input which can then be passed into the REPL. (Although the two approaches can be reconciled; see graphical-repl.scm in guile-gnome.) I think that fits slightly more naturally with your idea of a selectable REPL, so may be easier to implement in your app. In summary: lots of options, need more detail about how your overall app works and what you want it to look like. Regards, Neil