• 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

Theading palava

 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please can anyone tell me the state that a thread that join another thread is

that is, if i have
t.join();

t will be in what state.
 
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thr.join();

thr can be in any state. Only the thread that executes this line (the currentThread()) will be waiting:

#0, Calling thread: main, status: WAITING
#1, Calling thread: main, status: WAITING
#2, Calling thread: main, status: WAITING
#3, Calling thread: main, status: WAITING
#4, Calling thread: main, status: WAITING
#5, Calling thread: main, status: WAITING
#6, Calling thread: main, status: WAITING
main ready




Yours,
Bu.
 
Juwonlo Ibigbami
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bu, thanks
Before the main got ready, it was in what state?
-blocked or sleep or waiting
 
Burkhard Hassel
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy!

While the other thread is running, main is waiting.
When the other thread is dead, main gets into the runnable and finally in the running state.
In running state it prints its last line and dies after this.

Bu.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic