-2

What is the ideal response on Stack Overflow when we encounter two contradictory pieces of information, but we aren't sure which one is correct? Is it acceptable to post another question asking for clarification?

In this case, I am curious whether the isAlive() property of Java's Thread class can return false before the thread has started. The comment on this answer from 2009, with two upvotes, says that it can: How to know if other threads have finished?

This answer, from 2013 and with more upvotes, says that it cannot: When is a Java thread alive?

I say "when we don't know which is correct" because if we did know, I think the best response would be to post a correction to whatever one was wrong.

8
  • 1
    In this particular case, the correct advice would be 'don't use isAlive at all - if you think you need it, you're doing something wrong' Commented Mar 23, 2018 at 21:38
  • 1
    This seems like one of those questions that is most easily answered by trying it. You know, in code? But I don't know from Java. Commented Mar 23, 2018 at 21:51
  • @MartinJames why do you say that? It seems like polling on isAlive() would be the best way to wait for a thread to finish while simultaneously doing other things. Anyway I had a question about how best to accomplish that which I posted here (stackoverflow.com/questions/49458824/…) and I ended up just asking about the contradiction in my preface.
    – Stephen
    Commented Mar 23, 2018 at 22:00
  • @MikeMcCaughan I thought the same thing, but if the issue is that isAlive() could return false for like a millisecond before the thread starts, it could be hard to verify.
    – Stephen
    Commented Mar 23, 2018 at 22:02
  • ..and could return true after the thread method exits. Commented Mar 23, 2018 at 22:05
  • It is just not contradictory. The highly voted answer includes the clause "if it has been started". Try it. And think for a bit if it is useful at all to check if it alive if you didn't start it yet. Commented Mar 23, 2018 at 22:14
  • @HansPassant the contradiction is between the highly voted answer "A thread is alive if it has been started and has not yet died" and the comment "isAlive returns false if the thread hasn't started executing yet (even if your own thread has already called start on it)". Nobody is talking about calling isAlive on a thread that we haven't started.
    – Stephen
    Commented Mar 23, 2018 at 22:18
  • I seriously doubt the warranty and money-back guarantee you want is available here. Commented Mar 23, 2018 at 22:24

1 Answer 1

4

If you do not trust the answer(s) to a question, and want to draw more attention to it, such that you get more feedback on the quality of various answers, then you can post a bounty.

Asking a new question just because you have the exact same question as an existing question, and simply want more attention drawn to those existing answers, isn't really appropriate.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .