从goroutine调用阻止的DLL函数?

I'm writing a Go program for Windows that will call into a C DLL that I wrote and built separately. The C function will run an event loop that spends spend most of its time in a blocking system call.

The goroutine looks like this: 1) Load the DLL 2) Find the function by name 3) call it, which will return only when I'm shutting down the process.

I know goroutines aren't "real" threads but is it safe to treat it as one in this case? So far this program seems to do exactly what I want it to but I'm a little worried the goroutine scheduler is going to bite me at some point.

Is this safe? Thanks!

Then you make syscall all os thread locks and waits the syscall end. All other threads works well.

For better concurrency you can use runtime.LockOSThread() to move out all goroutines from current os thread.