On Sat, Feb 15, 2003 at 08:36:36PM -0600, Rob Mayoff wrote:
> I speculate (having looked at the 4.0 source but not having run 4.0)
> that 4.0 gives each virtual server its own set of NSVs. So when a
> So if you're invoking some NsTclNsv*ObjCmd directly, you should pass an
> NsInterp pointer as its ClientData. Note that those functions do not
> appear to be part of the AOLserver C API. If you had a Tcl_Interp that
> belongs to the appropriate virtual serve, you could legally fish out a
> pointer to an NsTclNsv*ObjCmd using Tcl_GetCommandInfo. You'd get both
> the pointer to the function (in infoPtr->objProc) and the appropriate
> ClientData to pass to it (in infoPtr->objClientData).
Ah, so I tried like so:
rc = Tcl_GetCommandInfo(interp, tcl_cmd, &CmdInfo);
if (rc == 0) {
Ns_Log(Error, "%s: %s: Tcl_GetCommandInfo says Tcl command '%s' does not exist!",
MODULE_NAME, func_name, tcl_cmd);
}
/* CmdInfo.objProc is: NsTclNsvSetObjCmd */
rc = CmdInfo.objProc(CmdInfo.objClientData, interp, argc, objv);
and in a CONNECTION thread, that works. But in other threads,
Tcl_GetCommandInfo returns 0 indicating that the command "nsv_set"
does not exist. E.g.:
[17/Feb/2003:18:34:35][998.1][-main-] Error: nsvapi: BB_NsvSet: Tcl_GetCommandInfo
says Tcl command 'nsv_set' does not exist!
What's going on here?
On Mon, Feb 17, 2003 at 11:40:44AM -0500, Jim Davidson wrote:
> It turns out the ClientData can be NULL for interps created without a virtual
> server such as the startup/config interp and interps created after libnsd.so
> is loaded into tclsh (which is a weird new possibility). A few commands deal
> with that directly (e.g., ns_info), others ignore ClientData anyway, and
> others simply don't exist in such interps. The command create code in
> nsd/tclcmds.c takes care of this.
Based on this, when Tcl_GetCommandInfo returned failur I tried forging
ahead and calling NsTclVSetCmd with NULL ClientData, but all that got
me was a segfault:
[17/Feb/2003:18:29:04][827.1][-main-] Error: nsvapi: BB_NsvSet: Tcl_GetCommandInfo
says Tcl command 'nsv_set' does not exist!
Segmentation Fault (core dumped)
Also, the Tcl procs I've defined don't seem to work in non-connection
threads either. I definitely get "invalid command name" errors both
in the -main- and various detached threads (e.g., -thread6-,
-thread7-). Why? Do I need to configure something different for
AOLserver 4.0?
The location of my Tcl library is defined like so:
ns_section ns/server/$server_name/tcl
ns_param Library $server_root/tcl
So is something breaking because that's only for the "virtual server",
not for all servers in the AOLserver process?
ns_section ns/server/$server_name/tcl
ns_param Library $server_root/tcl
I tried adding "ns_section ns/tcl" and "ns_section ns/server/tcl" as
well, but that didn't seem to help.
I really don't NEED or want anyb virtual server support for this
AOLserver process. How do I just make all my Tcl procs visible to all
threads, like under AOLserver 3.x?
--
Andrew Piskorski <[EMAIL PROTECTED]>
http://www.piskorski.com