My favorite thing about channels is how they're a universal synchronization primitive. A channel is not just a channel, but also: - a mutex - a semaphore - a wait group - a parker - and a lot more... 1/5
-
-
Wait group: https://golang.org/pkg/sync/#WaitGroup … Make a channel of any capacity that is initially empty. To add an item, make a clone of Sender. To remove an item, drop a Sender. To wait until the wait group is empty, call recv(). 4/5
Show this thread -
Parker: https://doc.rust-lang.org/std/thread/fn.park.html … Make a channel of capacity 1 that is initially empty. To park the current thread, call recv(). To unpark a thread, call try_send(()). 5/5
Show this thread
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.