J
javateamPL
Hello,
I have a class which is not a thread which executes the following
code:
public void myFunc() {
MyMainThread thread = new MyMainThread();
thread.start();
....
exec(arrayListFromThread);
....
}
A thread creates many subthreads which role is to fill in the
ArrayList (defined for thread). Next, I would like to pass this
arrayList to myFunc in the moment when all subthreads have finished
its job (so that I am sure that arraylist is complete) and immediately
start exec method.
I have two problems:
- how to pass this arrayList from thread (can I simply use method from
thread to return it? will the thread be still active?)
- how can I suspend an execution of myFunc() till the mainThread
finish creating arrayList?
Would be very grateful for effective solutions of these problems.
Regards, Mark
I have a class which is not a thread which executes the following
code:
public void myFunc() {
MyMainThread thread = new MyMainThread();
thread.start();
....
exec(arrayListFromThread);
....
}
A thread creates many subthreads which role is to fill in the
ArrayList (defined for thread). Next, I would like to pass this
arrayList to myFunc in the moment when all subthreads have finished
its job (so that I am sure that arraylist is complete) and immediately
start exec method.
I have two problems:
- how to pass this arrayList from thread (can I simply use method from
thread to return it? will the thread be still active?)
- how can I suspend an execution of myFunc() till the mainThread
finish creating arrayList?
Would be very grateful for effective solutions of these problems.
Regards, Mark