[Xotcl] XOTcl and Thread

Stefan Sobernig stefan.sobernig at wu.ac.at
Fri Feb 11 10:15:43 CET 2011

>> What would be the proper way to "register" the object myObject (which already exists) in another thread?
> No way. You need to ask Gustaf to give you serialisation-code
> that you can use to replicate your object/classes blueprints
> from one thread into others as a matter of thread inits.

I can help out here: In order to serialize an object (in XOTcl, creating 
a canonical script from a in-memory snapshot of the given object, 
capable of creating an object and its dependencies with all the 
shebang), [package require] the serializer package which comes with your 
XOTcl distribution:

Class create C -slots {
   Attribute a1 -default aaa
} -set x 1

C create c1

package req xotcl::serializer

# this provides a new method to all ::xotcl::Object instances, i.e. all 
# objects -> serialize():

c1 serialize

-> ::C create ::c1 -noinit \
	-set a1 aaa

the resulting script can be stored (e.g., in a tsv) and shared between 
thread interps. in the target interp, simply [eval] the script.


More information about the Xotcl mailing list