On Wed, Feb 15, 2017 at 10:43 AM, Yucong Sun <sunyuc...@gmail.com> wrote:
> So, to give more background,  i am trying to porting a C based
> interpreter to Go.  In the single threaded C code, the signal is
> always handled by interrupting whatever code was executing and
> directly exit after executing some "crash()" cleanup function.

Why can't you do exactly that in Go?


> Now, I ported the main function to Go, as I demonstrated above, there
> is no way to "interrupt" C code anymore, so I can't run crash()
> cleanly as before. This seems to be a limitation of Go, and I couldn't
> think of any way to work around it.

If you want to implement the precise behavior of a single-threaded C
program, then you need to write a single-threaded Go program.  But
that goal is clearly folly.  Don't try to write C code in Go.  When
you are using Go, write Go code.  That means: arrange your program as
a Go program.

Ian

-- 
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