The different framework decide c/go have to be in different loop ,,a c
loop and a go loop.
It is hard to change that,
2017-04-28 16:17 GMT+08:00 :
>
>
> On Friday, April 28, 2017 at 9:18:03 AM UTC+3, hui zhang wrote:
>>
>> How let go and c code work Alternately in the same
I tried , it is *not* in the same thread. if cwork and gowork call
thread-unsafe api, it will crash
package main
// #include
import "C"
import (
_ "fmt"
"time"
"runtime"
)
var go_done = make(chan bool, 1)
var c_done = make(chan bool, 1)
func init() {
runtime.GOMAXPROCS(1)
On Friday, April 28, 2017 at 9:18:03 AM UTC+3, hui zhang wrote:
>
> How let go and c code work Alternately in the same thread with
> goroutine(corouting mechanism)
> Check the code below. c and go code in one thread they just do work 1 by
> 1.
> Expected Result
>
>> Do CWork
>> Do GoWork
>>