Topic: 请教高人java.lang.Object.wait(long)函数

  Print this page

1.请教高人java.lang.Object.wait(long)函数 Copy to clipboard
Posted by: blueman
Posted on: 2006-01-14 22:45

我们项目代码里面有一个定时发送命令的线程,实现是这样的:
while(!stop)
{
synchroinzed (sync)
{
sync.wait(interval);
}
}

很奇怪的是,有时候wait的时间比指定的interval要长,这是怎么回事?哪位高人指点一下,谢谢。

2.Re:请教高人java.lang.Object.wait(long)函数 [Re: blueman] Copy to clipboard
Posted by: ranchgirl
Posted on: 2006-01-17 05:43

No, there is no guarantee it will be wake up at the specified time. It will depend on the cpu or other running threads, etc..

What you said is normal!

3.Re:请教高人java.lang.Object.wait(long)函数 [Re: blueman] Copy to clipboard
Posted by: blueman
Posted on: 2006-03-09 09:13

No, there is no guarantee it will be wake up at the specified time. It will depend on the cpu or other running threads, etc..
--------
ranchgirl,你好。您是否能介绍点这方面的资料?


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923