Forum OpenACS Development: Pass Tcl sockets or channels between threads

Collapse
Posted by Andrew Piskorski on
Connection pooling to what? I assume you are not writing any C code, but instead want to do this entirely from Tcl using either the Tcl socket, AOLserver ns_socket, or similar commands. This is definitely a Tcl and/or AOLserver question, you need to ask them, this has nothing directly to do with OpenACS. What you want is to "share Tcl channels" between multiple threads. By default, you cannot do this.

However, I do vaguely remember this coming up before on the AOLserver list before (e.g., July 2003, Nov. 2002, July 2002) and people have independently solved this at least twice, likely three times.

I would first check the latest versions of the Tcl Threads Extension. From its latest docs it does not seem to support passing channels between threads, but you might want to ask Zoran (its maintainer). He no doubt is much more familiar with all this channel passing stuff, both in Tcl and in AOLserver.

If the Tcl Threads extension does not support channel sharing/passing between threads, then I would check out the older nssharechannel or dqd_utils AOLserver modules, which definitely do support this. There's also the AOLserver 4.x ns_chan command, mentioned in some the threads above.

Collapse
Posted by Harish Krishnan on
Hi Andrew.. We had implemented a TCL API for memcacheD . When I was trying to integrate it with openacs I realized that I had to open a socket connection for each thread/connection. Hence I was figuring out a way to keep the socket alive between threads and pass it around.

Thanks for the information.

Collapse
Posted by Andrew Piskorski on
Ah, I see Harish, you're probably picking up on the work you first mentioned a year ago. Tom Jackson's NetV prototype and Memcached were also discussed in that thread. Is your memcached Tcl API publically available anywhere? It sounds useful.
Collapse
Posted by Harish Krishnan on
Andrew I would make it available publicly soon, I am currently tied up a couple of important issues.