mithrandie/csvq-driver

How csvq.SetStdout works across multiple processes?

hw2499 opened this issue · 3 comments

How csvq.SetStdout works across multiple processes?
I hope it works properly in multiple threads.

      for i1 := 0; i1 < 20; i1++ {
	go func(){
                  ...  to do thing ...

                       stdout := query.NewOutput()
                   csvq.SetStdout(stdout)

                   ...  to do thing ...

                       fmt.Println("stdout.String:", stdout.String())
                    if len(stdout.String()) == 0 {
	                fmt.Println("error -> query is null")
                    }

                  
            }()
}
runtime.Gosched()
time.Sleep(5 * time.Second)
fmt.Println("over")

Csvq does not intend to use different inputs and outputs for different threads, and specifying them in a goroutine will affect other goroutines as well.

How can CSVQ create multiple instances?

Sorry, I missed this question.

Outputs are only intended for logging, so multiple output destinations are not currently available.