This gets a conn:

  Ns_Conn *conn;

  /* get connection structure  */
  conn = Ns_TclGetConn(interp);
  if (conn == NULL) {
    Tcl_AppendResult(interp, "NULL conn??", NULL);
    return TCL_ERROR;

But a detached thread won't have a conn structure - it isn't associated
with a connection.

I think you can go directly to TCL, for example:

  string = Tcl_GetVar(interp, argv[2], 0);
  if (string == NULL) {
    Tcl_AppendResult(interp, "can't access variable ", argv[2], NULL);
    return TCL_ERROR;
  }

This returns a (local) TCL variable to your C modules. I think you can
do Tcl_Eval (or whatever it is called - Rob would know) without
needing a conn structure, assuming that there is a TCL interpreter
associated with your detached thread.  Guess it depends whether your
thread was originally started from a C modules or a TCL module.

Jim

> If I've got a detached thread running some C code, how might I go about
> executing a Tcl procedure.  Ns_TclEval looks like what I'm looking for, but
> it needs a server connection (as far as I can tell from the documentation).
> If anyone has done this before, or could give me some pointers/examples it'd
> be much appreciated.
>
> Cheers,
> Pete.
> --
> Peter Harper
> [EMAIL PROTECTED]
> --
>

Reply via email to