Re: Thread.getState() very slow

2010-07-11 Thread Martin Buchholz
On Sun, Jul 11, 2010 at 15:20, David Holmes wrote: > I thought this would be fairly simple but looking deeper into this it is a > lot more complicated than I thought. There is a three-level mapping from: > > OS/VM thread state -> VM ThreadStatus -> java.lang.ThreadState > > and it is a M:N:1 mapp

Re: Thread.getState() very slow

2010-07-11 Thread David Holmes
Hi Doug, Doug Lea said the following on 07/11/10 21:20: Also, while I'm at it, field Thread.threadStatus is suspiciously not declared volatile. Agreed - technically this should be a volatile field. In practice I think it only means that the window in which a stale value might be seen is slig

Re: Thread.getState() very slow

2010-07-11 Thread Doug Lea
On 07/11/10 00:09, David Holmes wrote: Doug Lea said the following on 07/10/10 23:35: I've been trying out some improvements in ForkJoin that involve repeatedly scanning threads to check whether they are still in state Thread.State.RUNNABLE. My question is why you want to check for Runnable? I