the case of a leaky goroutine: fix paragraph nl
This commit is contained in:
parent
51c401246d
commit
893126b10b
|
@ -7,7 +7,7 @@ tags:
|
||||||
- go
|
- go
|
||||||
---
|
---
|
||||||
|
|
||||||
In the programming language Go, it's _very_ easy to program something using high-level concurrent patterns thanks to the concept of _Goroutines_ and channels used to signal between them. A Goroutine is essentially a coroutine that maps onto green threads that map onto real native threads on your OS in an `NxM` way. The simple `go func()` prepend-style syntax makes fire-and-forget Goroutines for executing small tasks in parallel trivial.
|
In the programming language Go, it's _very_ easy to build something using high-level concurrent patterns thanks to the concept of _Goroutines_ and channels used to signal between them. A Goroutine is essentially a coroutine that maps onto green threads that map onto real native threads on your OS in an `NxM` way. The simple `go func()` prepend-style syntax makes fire-and-forget Goroutines for executing small tasks in parallel trivial.
|
||||||
|
|
||||||
Or is it? If we are to believe Katherine Cox-Buday, the author of O'Reilly's [Concurrency In Go](https://katherine.cox-buday.com/concurrency-in-go/), it's not:
|
Or is it? If we are to believe Katherine Cox-Buday, the author of O'Reilly's [Concurrency In Go](https://katherine.cox-buday.com/concurrency-in-go/), it's not:
|
||||||
|
|
||||||
|
@ -35,8 +35,6 @@ Once you managed to get your profile dump, you can analyze it with `go tool ppro
|
||||||
|
|
||||||
Let's get back to that context that's never truly cancelled. This piece of code is the perpetrator:
|
Let's get back to that context that's never truly cancelled. This piece of code is the perpetrator:
|
||||||
|
|
||||||
enkel een context. In plaats van verder te werken op die context door middel van context.WithCancel(...) gebruikten wij de volgende func om die omvorming te doen:
|
|
||||||
|
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func ToDoneInterface(done <-chan struct{}) <-chan interface{} {
|
func ToDoneInterface(done <-chan struct{}) <-chan interface{} {
|
||||||
|
|
Loading…
Reference in New Issue