multithreading

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bharatkbr
    New Member
    • Jan 2007
    • 4

    #1

    multithreading

    i did't understand the purpose of "JOIN()" method.please help me.
    now, i have been learning java.i follow the book called "THE COMPLETE REFERENCE".
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by bharatkbr
    i did't understand the purpose of "JOIN()" method.please help me.
    now, i have been learning java.i follow the book called "THE COMPLETE REFERENCE".
    Suppose you're building a house for me and I want to move in. I have nothing
    else to do so I 'join' you until you're finished; then I can do what I want to do:
    move in to my new house. The joining doesn't imply I start working on my future
    house though, I simply wait until you have finished doing your job, then I wake
    up and move in.

    kind regards,

    Jos

    Comment

    • teddarr
      New Member
      • Oct 2006
      • 143

      #3
      So...in essence you are starting the "move in" thread right after the "build house" thread is complete, or maybe coupling the to threads together like cars on a train?

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Originally posted by teddarr
        So...in essence you are starting the "move in" thread right after the "build house" thread is complete, or maybe coupling the to threads together like cars on a train?
        Yep, the "move" thread joins the "build" thread. When the "build" thread is
        finished the "move" thread wakes up again. That's what the join() method does.
        As long as the "build" thread isn't finished, the "move" thread keeps on sleeping.

        kind regards,

        Jos

        Comment

        Working...