There is an enum structure,but I don't understand the meaning of '0xDEAD - 2' in this enum.
enum TerminatedTypes {
_not_terminated = 0xDEAD - 2,
_thread_exiting,
_thread_terminated,
_vm_exited
};
From the code above,What kind of benefit can I get?
The code above is in 'hotspot/src/share/vm/runtime/thread.hpp' in openjdk8.
I am studying source code of jdk,please help me.
It's a hex literal, being used as an eyecatcher (useful in debuggers) so that the _thread_terminated
value will be 0xDEAD
("terminated thread" equals "dead").
There's a host of hex literals people use for things like that, such as DEADBEEF
from the Jargon file, and so on.