Source File
ready.go
Belonging Package
github.com/gotd/td/internal/tdsync
package tdsyncimport ()// Ready is simple signal primitive which sends signal once.// This is not allowed to use zero value.type Ready struct {wait chan struct{}done int32}// NewReady creates new Ready.func () *Ready {return &Ready{wait: make(chan struct{}),}}func ( *Ready) () {.wait = make(chan struct{})atomic.StoreInt32(&.done, 0)}// Signal sends ready signal.// Can be called multiple times.func ( *Ready) () {if atomic.CompareAndSwapInt32(&.done, 0, 1) {close(.wait)}}// Ready returns waiting channel.func ( *Ready) () <-chan struct{} {return .wait}
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |