• Post Reply Bookmark Topic Watch Topic
  • New Topic

Multiple Threads - runnable, join and yield.

 
Sally Conner
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm to change someone elses code and having trouble understanding it.
Runnable is used since the GeneralForm is extended by many classes.
This is simplified excerpts.
5 Questions; 1-4 on THE CODE below, then 5 a further complication.
Basically trying to decide if threads complete or whether other action on screen interrupts them
(action before dialogs appear; or action on dialogs).

1) What is the thread.join() joining to?
Eg. Does thread1.join() force the current thread to remain active until thread1 is done?
2) waitDialog.waitForShow is part of the findRecord thread. Am I correct that the findRecord method may not be complete when waitForShow begins?
ie. In waitForShow,
Thread.currentThread().yield();
will allow findRecord to continue.

3) However, what is the effect of in waitDialog.waitForShow, of:
animation.stopAnimation()
which has a thread.join()?
In the case below, animation thread has a join. Does the code force the animation to continue until the findRecord thread is complete?
(findRecord completion is by process completion or CANCEL_PRESSED)

4) Is the animation guaranteed to run?
What if person clicks on screen starting other actions.

THE CODE:

QUESTION 5) Of course, to complicate things more, classes extending GeneralForm also have threads in an overridden method. This new class's addRecord method should complete as a unit. Wondering if at the "***" we should be using thread.join()?Or is threadGroup somehow involved. Or should a new thread simply not be started here at all?
(This new thread was introduced by us since data results suggested the interface was not completing.)
Use of priorities would not be exclusively effective since we are in a timeslicing environment.

[This message has been edited by Marilyn deQueiroz (edited September 08, 2001).]
 
Marilyn de Queiroz
Sheriff
Posts: 9079
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

QUESTION 5) Of course, to complicate things more, classes extending GeneralForm also have threads in an overridden method. This new class's addRecord method should complete as a unit. Wondering if at the "***" we should be using thread.join()?Or is threadGroup somehow involved. Or should a new thread simply not be started here at all?
(This new thread was introduced by us since data results suggested the interface was not completing.)
Use of priorities would not be exclusively effective since we are in a timeslicing environment.


[This message has been edited by Marilyn deQueiroz (edited September 12, 2001).]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!