• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JQ+->Threads-->waitForAll()

 
Vikrama Sanjeeva
Ranch Hand
Posts: 760
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OH!.I never ever heard about this method before in my life.... waitForAll()
Here is the question.
Question ID :958269346510
Which of the following may pause/stop the current thread?
1:calling Thread.yield()
2:calling stop() on an object of class Thread
3:calling someObject.wait()
4:calling someObj.notify()
5:calling waitForAll on MediaTracker Object
Correct Answer are 1,2,3 & 5.
A/C to me 1: is correct, since it is not must that the thread which has called yield will leave Running state.
2:is obviously correct,will stop the calling Thread.
3:The calling Thread will must leave the running state & move to waiting state(in this case monitor is also release)
4:wait(),notify() & notifyAll() are always called on Threads rather than Objects.
5: Viki.waitForAllRanchers()???
Bye.
Viki.

------------------
Count the flowers of ur garden,NOT the leafs which falls away!
 
Rashmi Tambe
Ranch Hand
Posts: 418
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Three is no such method like waitForAll(). And That's for sure!!! Either the answers are wrong or you r having older version of JQ+
Rashmi
 
Jose Botella
Ranch Hand
Posts: 2120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why calling aThread.stop() would stop other thread than aThread ? I don't think 2 is ok.
According to API MediaTracker.waitForAll waits untill all the images are loaded.
 
Jim Hall
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rashmi Gunjotikar:
Three is no such method like [b]waitForAll(). And That's for sure!!! Either the answers are wrong or you r having older version of JQ+
Rashmi[/B]

You really should check the API before making a statement like that, because it does exist.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic