Answer the question
In order to leave comments, you need to log in
Spurious wakeup simulation
Question - how to write a test that demonstrates spurious wakeup under debian (or windows) using oracle jre 6?
A search on the subject yielded this thread:
stackoverflow.com/questions/6700917/forcing-a-spurious-wake-up-in-java
Which completely describes my question, and in which, alas, there is no answer to it.
Yes, signals and truth (at least with sun java in debian) don't result in a spurious wakeup.
PS No need to copy the most popular answer from the link, talking about the "accidental" notify ()
Answer the question
In order to leave comments, you need to log in
If you read the OpenJDK sources, you can find out what wait
leads to thread parking using os::PlatformEvent::park
. For src/os/linux/vm/os_linux.cpp
inside them there is a cycle of the form
while (_Event < 0) {
status = os::Linux::safe_cond_timedwait(_cond, _mutex, &abst);
//...
}
_Event
, only the method call can change unpark
. if (!FilterSpuriousWakeups) break ;
java
-XX:-FilterSpuriousWakeups
. The description of the option says that it is valid only for Solaris, but judging by the code, this is not the case. Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question