concurrency - Go: invoking methods concurrently isn't working for me -


this question has answer here:

i'm new go. i'm trying out example want perform concurrent call method. isn't working me (i don't see output).

based on "effective go", says concurrency supported methods , functions. doing wrong?

thanks, -srikanth

package main  import (     "fmt" )  type hello struct {     int }  func (h *hello) myprint (value string) {     go func() {         fmt.println(value)     } () }  func main() {     h := &hello{100}      go h.myprint("need go") } 

your main exits , process dies before goroutine has chance print output.


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -