[Xotcl] XOTcl and Thread
Krzysztof Frukacz
frukacz.krzysztof at gmail.com
Thu Feb 10 14:27:13 CET 2011
Hello again,
I am trying to add multi-threaded support for my application. I now face
a problem witch combining XOTCl and Thread. The problem is that
::thread::create creates a new instance of interpreter which has own
variables. I can have variables shared between threads using ::tsv
functions. So here is how it looks:
1. Thread #1 creates object myObject and stores in a shared variable:
::tsv::set array1 key1 [MyClass myObject]
2. Thread #2 gets the shared variable and tries to call a proc defined
for MyClass:
set localVar [::tsv::get array1 key1]
$localVar doSomething
At this point second thread will throw en exception saying:
Unknown command 'myObject'
What would be the proper way to "register" the object myObject (which
already exists) in another thread?
--
Krzysztof
More information about the Xotcl
mailing list