Call a different method from a class that is already running as thread?

Call a different method from a class that is already running as thread?

Post by Jan L » Wed, 18 Feb 2004 22:44:28


Hi,
i was wondering if it is possible to call a method (not run()) from a class,
that is already running
as a thread in the background. I want to do this, because i have got a main
class and from this
main class i start another class as background thread that works as a
receiver on a socket-connection.
But i need to send data over my socket too, and i am not sure if i should
place the method
for sending in my background-thread class, (if it is even possible) or if i
have too write a new
class just for the sending method. In the latter case i am not sure if it is
possible to pass one
object (my socket) from main-class to two other classes, working with the
same object.
I dont need the sending to be done in thread, besides.
Somehow confused about that,
thanks for any help!
Jan
 
 
 

Call a different method from a class that is already running as thread?

Post by Joona I Pa » Wed, 18 Feb 2004 22:53:39

"Jan Li" < XXXX@XXXXX.COM > scribbled the following:

As long as you've got a reference to the object that has its run()
method running as a thread, you can call any methods you wish on it.
Knock yourself out!

--
/-- Joona Palaste ( XXXX@XXXXX.COM ) ------------- Finland --------\
\-- http://www.yqcomputer.com/ ~palaste --------------------- rules! --------/
"'So called' means: 'There is a long explanation for this, but I have no
time to explain it here.'"
- JIPsoft