From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Charlie Root Newsgroups: gmane.lisp.guile.user Subject: Integrating guile into an existing multi-threaded application Date: Tue, 4 Jun 2002 22:53:17 -0700 (PDT) Sender: guile-user-admin@gnu.org Message-ID: <20020605055317.12707.qmail@web12502.mail.yahoo.com> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1023256530 7529 127.0.0.1 (5 Jun 2002 05:55:30 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 5 Jun 2002 05:55:30 +0000 (UTC) Return-path: Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 17FTlZ-0001xK-00 for ; Wed, 05 Jun 2002 07:55:29 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17FTkA-0007Tb-00; Wed, 05 Jun 2002 01:54:02 -0400 Original-Received: from web12502.mail.yahoo.com ([216.136.173.194]) by fencepost.gnu.org with smtp (Exim 3.34 #1 (Debian)) id 17FTjS-0007PX-00 for ; Wed, 05 Jun 2002 01:53:18 -0400 Original-Received: from [158.252.218.8] by web12502.mail.yahoo.com via HTTP; Tue, 04 Jun 2002 22:53:17 PDT Original-To: guile-user@gnu.org Errors-To: guile-user-admin@gnu.org X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.user:536 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:536 Hi, Yes, another pthread question. I've been through the list archives, read what docs there are, looked a bit at the code, and had a few questions answered. But before I take off in the wrong direction, I'd appreciate some advice. I am considering using guile inside an existing multi-threaded (pthreads, solaris 2.6,7,8) application. I'm aware of many of the limitations (at least as of October 2001, which is the latest message I've seen on the issue) including using guile inside a single thread. So here's a proposed sketch of the project. Any obvious faulty thinking? We have a client-server architecture. Data enters the client, and is passed to the server. At startup, the server loads an arbitrary number of processing modules. When the server receives a data packet from the client, it spawns a processing thread. This thread runs the data through each of the processing modules in sequence. Many of these threads (thousands, sometimes) exist simultaneously. What I want to do is to write a processing module which uses Guile. The module will load its (scheme) processing commands at startup, and munge data using this scheme code when called from a processing thread. As a bonus constraint, I'm not allowed to modify the server itself. So far as I can tell, this means that the guile module will need to spawn an interpreter thread at server startup time, and then when it processes a data packet, send the data off to the interpreter thread and wait for a response. Probably the guile call will be gh_eval_str(), since I will be feeding it data and waiting for responses to pull back into C. Now, this is kind-of asking for a bottleneck right there, but I can imagine using guile's threads to ease it somewhat if it becomes a problem. So here are some questions: . The guile interpreter may not be fired up by the process's main thread, but some other one, and at some other time than the end of main(). Is this a problem? . I don't understand the arguments to gh_enter(). The main thread's argc and argv will not be available to gh_enter(). If the `inner_main' of gh_enter() is not going to need data passed to it, can these contain dummy values? . Will I be able to use guile's threads inside a system such as the one described (that is, inside a non-main thread) ? . Are there other obvious-to-the-seasoned-guiler sorts of issues that I'd do better with if I knew of in advance? Any thoughts on the situation are actively solicited. Thanks a whole bunch, -CR __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://mail.gnu.org/mailman/listinfo/guile-user