On Fri, 28 Sep 2018 22:27:04 -0700 (PDT)
changkun <euryugas...@gmail.com> wrote:

> Not really, the original C code calls pango in every new created thread.
> [...]
> the Pango call is always called in a newly created thread.

IIUC its your old C code spinning a new thread for each Pango
call (?). If so, you should not bridge such code directly with Go. You need
to make a wrapper on the C side (in C), init it from the **single** goroutine
you pin to a single (go side) thread then communicate only via said
wrapper calls.

[Go] <-go-channels-> [comm goroutine] <-cgo-call(s)-> [wrapper] <-C->
[library]

You can try to leverage existing C implementation of Go channels for
the wrapper:

https://github.com/tylertreat/chan

[IDNK if these are still functioning with go1.11, ofc]

Example:
https://github.com/matiasinsaurralde/cgo-channels

> Best,
> changkun
> 

Hope this helps,

-- 
Wojciech S. Czarnecki
 << ^oo^ >> OHIR-RIPE

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to