Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ADTOSync ¶
type ADTOSync struct {
Invalidated bool
// contains filtered or unexported fields
}
func (*ADTOSync) SealWithTimeout ¶
type FastAsyncOnce ¶
type FastAsyncOnce struct {
// contains filtered or unexported fields
}
func (o *Once) Do(f func()) {
// Note: Here is an incorrect implementation of Do:
//
// if atomic.CompareAndSwapUint32(&o.done, 0, 1) {
// f()
// }
//
// Do guarantees that when it returns, f has finished.
// This implementation would not implement that guarantee:
// given two simultaneous calls, the winner of the cas would
// call f, and the second would return immediately, without
// waiting for the first's call to f to complete.
// This is why the slow path falls back to a mutex, and why
// the atomic.StoreUint32 must be delayed until after f returns.
p.s. we don't need that guarantee here, therefore need a CAS specifically
func (*FastAsyncOnce) Do ¶
func (o *FastAsyncOnce) Do(f func())
Click to show internal directories.
Click to hide internal directories.