Hi, I'm getting crazy trying to understand this problem...I have a multi threaded program with a queue and 2 methods, enter() and exit() which allow to enter/exit from it.
Between enter() and exit() a thread has to wait for 100ms, so the sequence is:
long time = System.currentTimeMillis();
queue.enter();
Thread.sleep(100);
queue.exit();
time = System.currentTimeMillis() - time;
just one thread at time can enter in queue so, in the end, I should have something like
t1 = 100+x (x is a plus for other operations)
t2 = 200+x
t3 = 300+x
but I obtain, instead, something like
t1 = 100+x
t2 = 195 +x
t3 = 264 +x
...how come? t2 should be AT LEAST 200!!