• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Interrupting a Thread

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can a Thread y interrupt a Thread x, if was x that has started Thread y?
 
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
X and Y are subclasses of Thread. An X object creates a Y object and starts the thread. The X object passes a reference to itself (a Thread object) to the Y object in the constructor.

X and Y implement Runnable. An X object creates a Y object. X passes a reference to the current thread in the constructor. X creates a Thread object and passes the Y object to the Thread object. X starts the thread.
 
Paulo Freitas
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot Marlene. That was exactly what I wanted to know.
 
Marlene Miller
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And thank you Paulo for letting me know I answered the question you were asking.
 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Marlene! I miss you!
Good news: I already got a job, and a good one. More details if you whant, email-me!
PS.: Paulo, are you from Brazil? I am Brazilian myself, and your name sound familiar.
 
Paulo Freitas
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Right on the spot!!! I am brazilian(SP), but I have been living in Toronto/Canada for almost 2 years.
 
reply
    Bookmark Topic Watch Topic
  • New Topic