Top "Goroutine" questions

A goroutine is a lightweight thread of execution that is managed by the Go language runtime.

How to asynchronously call a method in Java

I've been looking at Go's goroutines lately and thought it would be nice to have something similar in Java. As …

java concurrency asynchronous goroutine
How to stop a goroutine

I have a goroutine that calls a method, and passes returned value on a channel: ch := make(chan int, 100) go …

go goroutine channels
Example for sync.WaitGroup correct?

Is this example usage of sync.WaitGroup correct? It gives the expected result, but I am unsure about the wg.…

go goroutine
Catching return values from goroutines

The below code gives compilation error saying 'unexpected go': x := go doSomething(arg) func doSomething(arg int) int{ ... return my_…

go concurrency goroutine
Max number of goroutines

How many goroutines can I use painless? For example wikipedia says, in Erlang 20 million processes can be created without degrading …

go multitasking goroutine
How to wait for all goroutines to finish without using time.Sleep?

This code selects all xml files in the same folder, as the invoked executable and asynchronously applies processing to each …

go synchronization goroutine
Go, tcp too many open files debug

Here's a straightforward Go http (tcp) connection test script func main() { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, …

sockets tcp go goroutine
Parallel processing in golang

Given the following code: package main import ( "fmt" "math/rand" "time" ) func main() { for i := 0; i < 3; i++ { go f(…

parallel-processing go goroutine
Golang concurrency: how to append to the same slice from different goroutines

I have concurrent goroutines which want to append a (pointer to a) struct to the same slice. How do you …

concurrency go append goroutine
Golang context.WithValue: how to add several key-value pairs

With Go's context package it is possible to pass request-specific data to the stack of request handling functions using func …

go concurrency goroutine