github.com/haraldrudell/parl@v0.4.176/awaitable-ch.go (about) 1 /* 2 © 2023-present Harald Rudell <haraldrudell@proton.me> (https://haraldrudell.github.io/haraldrudell/) 3 All rights reserved 4 */ 5 6 package parl 7 8 // AwaitableCh is a one-to-many inter-thread wait-mechanic with happens-before 9 // - AwaitableCh implements a semaphore 10 // - implementation is a channel whose only allowed operation is channel receive 11 // - AwaitableCh transfers no data, instead channel close is the significant event 12 // 13 // Usage: 14 // 15 // <-ch // waits for event 16 // 17 // select { 18 // case <-ch: 19 // hasHappened = true 20 // default: 21 // hasHappened = false 22 // } 23 type AwaitableCh <-chan struct{}