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