On 2004.08.27, Brett Schwarz <[EMAIL PROTECTED]> wrote:
> Anyways, there is an open source PBX system (asterisk) that has an
> programming interface that is very similar to CGI (in fact it is
> called AGI). Right now, it forks off a process everytime an AGI is
> called (just like CGI). I would like to change that so that Tcl
> scripts are loaded in ahead of time, and are executed in process (no
> forking). Pretty much how aolserver runs tcl procs and tcl pages.

You specifically asked about embedding Tcl in a multithreaded
application.  Is Asterix multi-threaded?  If it is, and they fork and
exec a new process for each AGI invocation, that's interesting ...

The simplest thing to do is to start by not pre-loading all the scripts
ahead of time (since there's still no multi-threaded Tcl_CloneInterp()
function, loading them ahead of time may not benefit you much).  I'd
start by simply creating a new Tcl interp. and evaluate a script,
instead of fork/exec of an external program.  This also keeps a lof of
the headaches of multi-threaded programming out of your hair.  Expose
the Asterix API to Tcl by creating Tcl commands from C.

Once you've got that working, then just tune for performance as real
measurements dictate.

A good page to learn how to start embedding Tcl in your C app. can be
found on the Tcl'ers Wiki:

    How to embed Tcl in C applications
    http://wiki.tcl.tk/2074

-- Dossy

--
Dossy Shiobara                       mail: [EMAIL PROTECTED]
Panoptic Computer Network             web: http://www.panoptic.com/
  "He realized the fastest way to change is to laugh at your own
    folly -- then you can let go and quickly move on." (p. 70)


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of 
your email blank.

Reply via email to