Re: ANN: threads enabled Itcl



On Fri, 14 Jul 2006 08:40:47 +0200, Eckhard Lehmann <ecky-l@xxxxxx> wrote:

Hi all,

I've written a patch for Itcl that makes it possible to use Itcl
objects in multiple threads. It is possible to create an object e.g. in
the main thread (using the -ts/-threadshared option) and call methods
on it in a different thread.

Sounds really interesting! Especially when using things like AOLserver or writing other multithreaded servers.

The patch for Itcl and also one for Itk can be downloaded at
http://e-lehmann.de/?page_id=31, I wrapped up the sources and created
binaries for Linux and windows as well, and created a Wiki entry at
http://wiki.tcl.tk/16140.

I'm wondering about one thing, though. The main drawback should be that you need to either deepcopy the Tcl_Obj or convert to/from strings. Both seem very time consuming to me.

From what I remember with ns_cache from AOLserver, Tcl_Obj cannot be shared between threads. So if this is true, your code will probably fail when exiting Tcl or deleting the object, probably in a more complex scenario.

Also, how does it handle the following code:

namespace eval ::myns {}
A -threadshared ::myns::obj0

I would assume you may need to create the parent namespace in each other thread.

--
WK
.



Relevant Pages

  • ANN: threads enabled Itcl
    ... I've written a patch for Itcl that makes it possible to use Itcl ... objects in multiple threads. ... Please report bugs, if any, directly to me. ...
    (comp.lang.tcl)
  • Who maintains Itcl? & submitting patches
    ... is Michael Mc Lennan still maintaining Itcl? ... I have enhanced Itcl's functionality to provide "cget code" - code that ... Or should I provide the patch as "extension" to Itcl ...
    (comp.lang.tcl)