CheckAndSet is a simple concurrency control mechanism that allows only one goroutine to execute a critical section at a time.
| 19 | // CheckAndSet is a simple concurrency control mechanism that allows |
| 20 | // only one goroutine to execute a critical section at a time. |
| 21 | type CheckAndSet struct { |
| 22 | state bool |
| 23 | owner string |
| 24 | startT time.Time |
| 25 | mu sync.Mutex |
| 26 | } |
| 27 | |
| 28 | // NewCheckAndSet creates a new CheckAndSet instance. |
| 29 | func NewCheckAndSet() *CheckAndSet { |
nothing calls this directly
no outgoing calls
no test coverage detected