Discussion:
How to pass a class reference to another thread
(too old to reply)
k***@gmail.com
2010-07-29 13:00:39 UTC
Permalink
Hi,

I'm looking for a way to pass a class created inside a thread back to
the main thread.
The setoutparm methodes don't work for this.

I also tried to override the Thread class, add a parm methode but then
the thread isn't run successfully.

Is there a way to get the class reference and use the calculated
values, record buffers, .. from outside the "work" thread?

Thanks in advances,
Kenny
F van G
2010-08-01 21:21:03 UTC
Permalink
Hi,

I will assume that by 'passing a class back' you mean an object (an instance
of a class).

As the InParameter and the OutParameter of a thread is a Container, and
containers can not hold objects that are an instantiation of a class (they
can only hold value types), using the input/output parameters you will not be
able to pass an object back to the caller.

What you can however do is serialize the object (using a new implemented
method pack()), give the serialized container back using the OutParameter,
and construct a NEW object of the same class type, and implement an unpack()
to initialize relevant member variables.

If the object has references to non-AX objects, these can not be kept or
serialized. When that is the case, you are probably out of luck.

Hope this helps...
Post by k***@gmail.com
Hi,
I'm looking for a way to pass a class created inside a thread back to
the main thread.
The setoutparm methodes don't work for this.
I also tried to override the Thread class, add a parm methode but then
the thread isn't run successfully.
Is there a way to get the class reference and use the calculated
values, record buffers, .. from outside the "work" thread?
Thanks in advances,
Kenny
.
Loading...