Skip to content
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

Scala并发编程实战:Semaphore 信号量模型 | Liam's Blog #27

Open
Liam8 opened this issue Aug 26, 2019 · 0 comments
Open

Scala并发编程实战:Semaphore 信号量模型 | Liam's Blog #27

Liam8 opened this issue Aug 26, 2019 · 0 comments

Comments

@Liam8
Copy link
Owner

Liam8 commented Aug 26, 2019

https://liam-blog.ml/2019/08/26/Scala-Concurrency-Semaphore/

Semaphore信号量模型,是一种通过维护计数器数值来控制并发数量的模型,Lock实现的互斥锁只允许一个线程访问临界区,而Semaphore允许有限多个线程访问临界区。 什么情况需要允许多个线程同时访问?最常见的需求就是池化资源,连接池、线程池、对象池等等。 java.util.concurren.Semaphore 是JDK中的实现类,常用方法有这些: public Semaphore(int

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant