• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

how are the thread methods invoked

 
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
could someone please tell me how the following methods can be invoked ?
BY DIRECT, CLASS OR INSTANCE Or other methods
eg.
-----------------
class MyThread extends Thread {}
MyThread t = new MyThread();
1] MyThread.yield(),2] yield(),3] t.yield
---------------
1. yield
2. sleep
3.wait
4.interrupt
5.notify
6.notifyAll
thanks, please clarify if these can be called by other methods, or if ONLY THE EXISTING THREAD CAN CAN THEM ON THEMESELVES
 
Ranch Hand
Posts: 321
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
dear sarim,
yeild() and sleep() being the static method of the Thread class, operate on the currently executing thread.They can be called by class name or directly in which case it applies to the currently executing thread.
 
Friends help you move. Good friends help you move bodies. This tiny ad will help:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic