mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-25 16:30:25 +08:00
增加读写线程限制相关测试用例
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
package fsutils
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeNode/internal/remotelogs"
|
||||
"runtime"
|
||||
"time"
|
||||
)
|
||||
@@ -68,5 +69,13 @@ func (this *Limiter) TryAck() bool {
|
||||
}
|
||||
|
||||
func (this *Limiter) Release() {
|
||||
this.threads <- struct{}{}
|
||||
select {
|
||||
case this.threads <- struct{}{}:
|
||||
default:
|
||||
remotelogs.Error("FS_LIMITER", "Limiter Ack()/Release() should appeared as a pair")
|
||||
}
|
||||
}
|
||||
|
||||
func (this *Limiter) FreeThreads() int {
|
||||
return len(this.threads)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user