Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bostrt/golang-multi-chan-demo


https://github.com/bostrt/golang-multi-chan-demo

Last synced: 19 days ago
JSON representation

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{}{}...
B

Configuring 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{}{}...
A

Configuring A() and B() again...
Calling close(stop)...
B
A
B
```

References:
-
-