From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sylvain Beucler Newsgroups: gmane.lisp.guile.user Subject: Re: Long-lived Guile scripts in a mono-threaded game engine Date: Tue, 27 May 2008 21:57:07 +0200 Message-ID: <20080527195707.GA19385@perso.beuc.net> References: <20080526211900.GB14261@perso.beuc.net> <87fxs4yy89.fsf@gnu.org> <20080527083324.GA16693@perso.beuc.net> <87hccjnars.fsf@gnu.org> <20080527161445.GB18239@perso.beuc.net> <87bq2rhb63.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1211918253 28026 80.91.229.12 (27 May 2008 19:57:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 27 May 2008 19:57:33 +0000 (UTC) Cc: guile-user@gnu.org To: Ludovic =?iso-8859-1?Q?Court=E8s?= Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue May 27 21:58:14 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 1K15JA-0002d8-5M for guile-user@m.gmane.org; Tue, 27 May 2008 21:58:08 +0200 Original-Received: from localhost ([127.0.0.1]:58595 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K15IN-0006ys-Ek for guile-user@m.gmane.org; Tue, 27 May 2008 15:57:19 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K15IJ-0006yn-Pp for guile-user@gnu.org; Tue, 27 May 2008 15:57:15 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K15II-0006yb-BB for guile-user@gnu.org; Tue, 27 May 2008 15:57:14 -0400 Original-Received: from [199.232.76.173] (port=59515 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K15II-0006yY-5V for guile-user@gnu.org; Tue, 27 May 2008 15:57:14 -0400 Original-Received: from smtp3-g19.free.fr ([212.27.42.29]:51011) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K15ID-0006WE-4M; Tue, 27 May 2008 15:57:09 -0400 Original-Received: from smtp3-g19.free.fr (localhost.localdomain [127.0.0.1]) by smtp3-g19.free.fr (Postfix) with ESMTP id 362AD17B5D9; Tue, 27 May 2008 21:57:08 +0200 (CEST) Original-Received: from localhost.localdomain (unknown [82.238.35.175]) by smtp3-g19.free.fr (Postfix) with ESMTP id 2126A17B5D3; Tue, 27 May 2008 21:57:08 +0200 (CEST) Original-Received: from me by localhost.localdomain with local (Exim 4.69) (envelope-from ) id 1K15IB-00054j-NJ; Tue, 27 May 2008 21:57:07 +0200 Content-Disposition: inline In-Reply-To: <87bq2rhb63.fsf@gnu.org> X-Operating-System: GNU/Linux User-Agent: Mutt/1.5.17+20080114 (2008-01-14) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) 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:6584 Archived-At: Hi, Thanks for your answers Ludovic and Clinton. > An alternative approach could use a thread per script. By the way, I have a question about threads: is there a way to kill a running thread? For example when the current game screen changes, all current scripts are terminated. Or does this need to be implemented manually? > > Yeah, I was trying to avoid introducing threads in the engine :) > > But it sounds like the only usable solution as of now. > > It's actually not silly now that we've entered the multicore era. That's a pro, but there are cons too :/ - this kind of game engine has hardly anything runnable in parallel - all the game globals need to be properly mutex'd - or threads executions need to be serialized which defeats the point Another pro though is that all of us masochists love debugging multithread programs ;) I'll try these solutions with my toy project and see how they fair with performances/complexity :) Thanks, -- Sylvain