Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bostrt/golang-multi-chan-demo
https://github.com/bostrt/golang-multi-chan-demo
Last synced: 19 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/bostrt/golang-multi-chan-demo
- Owner: bostrt
- Created: 2020-11-26T19:31:47.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2020-11-26T19:42:09.000Z (about 4 years ago)
- Last Synced: 2024-04-24T12:07:52.538Z (9 months ago)
- Language: Go
- Size: 1.95 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
A short demo showing that GoLang channels are non-deterministic when writing. But, a `close(chan)` is in terms of all readers receiving the close "signal".
```shell
$ go run test.go
Configuring A() and B() go-routines as stop channel readers...
Sending stop <- struct{}{}...
BConfiguring A() and B() again...
Calling close(stop)...
A
A
B$ go run test.go
Configuring A() and B() go-routines as stop channel readers...
Sending stop <- struct{}{}...
AConfiguring A() and B() again...
Calling close(stop)...
B
A
B
```References:
-
-