Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7689483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:10:32+00:00 2026-05-31T20:10:32+00:00

thread.join() will call thread.wait() , but who and when notifies (either with thread.notify() or

  • 0

thread.join() will call thread.wait(), but who and when notifies (either with thread.notify() or notifyAll()) the thread.wait()?

As we know, thread join will wait for the thread to be completed, but who calls notify on it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:10:34+00:00Added an answer on May 31, 2026 at 8:10 pm

    Edit:

    Oh, you are talking about inside of the Thread object itself. Inside of join() we do see a wait(). Something like:

    while (isAlive()) {
        wait(0);
    }
    

    The notify() for this is handled by the Thread subsystem. When the run() method finishes, the notify() is called on the Thread object. I’m not sure if the code that actually calls notify() can be seen — it seems to be done in native code.


    No user code needs to call notify() on that Thread object. The Java Thread code handles this internally. Once the thread finishes, the join() call will return.

    For example, the following code will execute fine and the join() call will return fine without any wait() or notify() calls.

    Thread thread = new Thread(new Runnable() {
       public void run() {
          // no-op, just return immediately
       }
    });
    thread.start();
    thread.join();
    

    It is important to note that this behavior should probably not be relied upon. The notify() call is internal to the thread system. You should use join() if you are waiting for a thread to finish.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this call my $th = threads->create(\&print, Hello thread World!\n); $th->join(); works fine. But as
If a thread is interrupted while inside Object.wait() or Thread.join() , it throws an
(Thread) A.join() - causes current thread to wait for the thread A to complete.
I saw a stackoverflow member suggest using Thread.join() to have a main thread wait
Is it OK not to call Thread#join ? In this case, I don't care
I have a function where I call thread.abort to kill a thread. I know
What is the significance of the Thread.Join method in C#? MSDN says that it
Can Thread.Abort interrupt a thread that is sleeping (using, say, Thread.Sleep(TimeSpan.FromDays(40)) ? Or will
I was browsing this thread , which has good recommendation but a bit too
can someone help me how to set Thread.join() method within my class or if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.