mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-13 18:00:00 +08:00
initial import
This commit is contained in:
13
core/syncx/barrier.go
Normal file
13
core/syncx/barrier.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package syncx
|
||||
|
||||
import "sync"
|
||||
|
||||
type Barrier struct {
|
||||
lock sync.Mutex
|
||||
}
|
||||
|
||||
func (b *Barrier) Guard(fn func()) {
|
||||
b.lock.Lock()
|
||||
defer b.lock.Unlock()
|
||||
fn()
|
||||
}
|
||||
Reference in New Issue
Block a user