diff options
author | Dmitriy Vyukov <dvyukov@google.com> | 2011-11-02 16:42:01 +0300 |
---|---|---|
committer | Dmitriy Vyukov <dvyukov@google.com> | 2011-11-02 16:42:01 +0300 |
commit | 19d9c44fc9f14579f3eead591815c499aea6ff96 (patch) | |
tree | 172eedcf40a2c23ee5aaef2a4cff51ff63d414b8 /src/pkg/runtime/Makefile | |
parent | 111e542ba11c838927eee9e5eb160dbf4de0dc5a (diff) | |
download | go-19d9c44fc9f14579f3eead591815c499aea6ff96.tar.gz |
runtime: unify mutex code across OSes
The change introduces 2 generic mutex implementations
(futex- and semaphore-based). Each OS chooses a suitable mutex
implementation and implements few callbacks (e.g. futex wait/wake).
The CL reduces code duplication, extends some optimizations available
only on Linux/Windows to other OSes and provides ground
for futher optimizations. Chan finalizers are finally eliminated.
(Linux/amd64, 8 HT cores)
benchmark old new
BenchmarkChanContended 83.6 77.8 ns/op
BenchmarkChanContended-2 341 328 ns/op
BenchmarkChanContended-4 382 383 ns/op
BenchmarkChanContended-8 390 374 ns/op
BenchmarkChanContended-16 313 291 ns/op
(Darwin/amd64, 2 cores)
benchmark old new
BenchmarkChanContended 159 172 ns/op
BenchmarkChanContended-2 6735 263 ns/op
BenchmarkChanContended-4 10384 255 ns/op
BenchmarkChanCreation 1174 407 ns/op
BenchmarkChanCreation-2 4007 254 ns/op
BenchmarkChanCreation-4 4029 246 ns/op
R=rsc, jsing, hectorchu
CC=golang-dev
http://codereview.appspot.com/5140043
Diffstat (limited to 'src/pkg/runtime/Makefile')
-rw-r--r-- | src/pkg/runtime/Makefile | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/pkg/runtime/Makefile b/src/pkg/runtime/Makefile index 725c2b07e..2d7b51b89 100644 --- a/src/pkg/runtime/Makefile +++ b/src/pkg/runtime/Makefile @@ -30,8 +30,24 @@ GOFILES=\ CLEANFILES+=version.go version_*.go +OFILES_darwin=\ + lock_sema.$O\ + +OFILES_freebsd=\ + lock_futex.$O\ + +OFILES_linux=\ + lock_futex.$O\ + +OFILES_openbsd=\ + lock_sema.$O\ + +OFILES_plan9=\ + lock_sema.$O\ + OFILES_windows=\ callback.$O\ + lock_sema.$O\ syscall.$O\ # 386-specific object files |