java 忙等待,Java信号量是否使用忙等待或默认等待/通知?

问题是这样的.我在

Windows 7上使用JDK 6.0,并尝试使用信号量作为解决同步问题的机制.它工作得很好,但我试图避免忙于等待我的问题.

我只想问一下java文档并省去了麻烦,但文档是这样的:

Acquires the given number of permits from this semaphore,

blocking until all are available, or the thread is interrupted.

Acquires the given number of permits, if they are available,

and returns immediately, reducing the number of available permits

by the given amount.

If insufficient permits are available then the current thread

becomes disabled for thread scheduling purposes and lies dormant

也就是说,文档似乎暗示了两个答案.哪一个是正确的?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值