--- Dossy Shiobara <[EMAIL PROTECTED]> wrote: > 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 ... >
yes, it is multi-threaded. They fork, because it is an external program. Just think of CGI. > 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 But, what is the impact of loaded them ahead of time? I thought that's was aolserver does (i.e. the tcl procs). I realize that there is some performance problems with cloning an interp, but isn't this done at startup time, where I don't necessarily care about timing? Or am I way off base here? > 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. > Here's one of the deals that I am clueless about mult-threaded programming. This is how I would think it would happen. The main thread would read that it is a Tcl app, and so it needs to send that to the Tcl_Interp. I would imagine that the Tcl_Interp would be in anther thread. So, I am assuming that there is communication between the threads. Is this similar to how aolserver does it? If so, where would I begin to look to see how data is passed back and forth? > 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 > I am familiar with embedding Tcl in C, I am just unsure how its works in a mult-threaded environment...especially how data is passed back and forth between the main C thread, and the thread that has Tcl embedded. thanks for the info...I am learning ;) --brett -- 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.
