diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2016-02-24 15:03:04 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2016-02-24 15:03:04 +0000 |
commit | 4501d9ad44510a07e5f07439275b39198268cf47 (patch) | |
tree | ba6682fd67d5ac4f735f2b1d2af42811595c001f /libgo | |
parent | f802a42401e16c7b918cee539e3c38f4d6f7a336 (diff) | |
download | gcc-4501d9ad44510a07e5f07439275b39198268cf47.zip gcc-4501d9ad44510a07e5f07439275b39198268cf47.tar.gz gcc-4501d9ad44510a07e5f07439275b39198268cf47.tar.bz2 |
runtime: lock M during cgo call
cgo should lock the M.
See also https://golang.org/cl/18882 .
Reviewed-on: https://go-review.googlesource.com/18883
From-SVN: r233670
Diffstat (limited to 'libgo')
-rw-r--r-- | libgo/runtime/go-cgo.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libgo/runtime/go-cgo.c b/libgo/runtime/go-cgo.c index a36eac9..610bcf5e 100644 --- a/libgo/runtime/go-cgo.c +++ b/libgo/runtime/go-cgo.c @@ -41,6 +41,8 @@ syscall_cgocall () if (runtime_needextram && runtime_cas (&runtime_needextram, 1, 0)) runtime_newextram (); + runtime_lockOSThread(); + m = runtime_m (); ++m->ncgocall; g = runtime_g (); @@ -70,6 +72,8 @@ syscall_cgocalldone () _cgo_panic will already have exited syscall mode. */ if (g->status == Gsyscall) runtime_exitsyscall (); + + runtime_unlockOSThread(); } /* Call back from C/C++ code to Go code. */ |