Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

修改为带参数的 poll(timeout, unit) 方法,避免误解和混淆 #2703

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Snailclimb merged 1 commit into Snailclimb:main from Joycn2018:patch-1
Aug 7, 2025

Conversation

Copy link
Contributor

@Joycn2018 Joycn2018 commented Aug 5, 2025
edited
Loading

无参 poll() 会立即从队列中取元素,如果队列为空,直接返回 null(不阻塞);
带超时参数的 poll(timeout, unit):在指定时间内等待队列有元素可用。如果超时仍未获取到元素,则返回 null。

建议这里增加参数,避免初学者对阻塞队列的poll()方法有误解

无参 poll() 会立即从队列中取元素,如果队列为空,直接返回 null(不阻塞);
带超时参数的 poll(timeout, unit):在指定时间内等待队列有元素可用。如果超时仍未获取到元素,则返回 null。
建议这里增加参数,避免初学者对阻塞队列的poll()方法有误列
Copy link
Owner

无参 poll() 会立即从队列中取元素,如果队列为空,直接返回 null(不阻塞); 带超时参数的 poll(timeout, unit):在指定时间内等待队列有元素可用。如果超时仍未获取到元素,则返回 null。

建议这里增加参数,避免初学者对阻塞队列的poll()方法有误解

感谢补充完善👍

@Snailclimb Snailclimb merged commit c366ac1 into Snailclimb:main Aug 7, 2025
@Snailclimb Snailclimb added the enhancement New feature or request or suggestion label Aug 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
enhancement New feature or request or suggestion
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /