diff options
| author | Dmitriy Vyukov <dvyukov@google.com> | 2012-05-11 10:50:03 +0400 |
|---|---|---|
| committer | Dmitriy Vyukov <dvyukov@google.com> | 2012-05-11 10:50:03 +0400 |
| commit | 95643647ae980f6d55e92d9ca22f262efa6bcde5 (patch) | |
| tree | aea28a6255fae980df61b90d449dee82f201639b /src/pkg/runtime/export_test.go | |
| parent | aa45e52e74f37e39a5a8234071742d50b87b7b2c (diff) | |
| download | go-95643647ae980f6d55e92d9ca22f262efa6bcde5.tar.xz | |
runtime: add parallel for algorithm
This is factored out part of:
https://golang.org/cl/5279048/
(parallel GC)
R=bsiegert, mpimenov, rsc, minux.ma, r
CC=golang-dev
https://golang.org/cl/5986054
Diffstat (limited to 'src/pkg/runtime/export_test.go')
| -rw-r--r-- | src/pkg/runtime/export_test.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/pkg/runtime/export_test.go b/src/pkg/runtime/export_test.go index d50040adcf..c1971cd2d1 100644 --- a/src/pkg/runtime/export_test.go +++ b/src/pkg/runtime/export_test.go @@ -36,3 +36,28 @@ func lfstackpop2(head *uint64) *LFNode var LFStackPush = lfstackpush var LFStackPop = lfstackpop2 + +type ParFor struct { + body *byte + done uint32 + Nthr uint32 + nthrmax uint32 + thrseq uint32 + Cnt uint32 + Ctx *byte + wait bool +} + +func parforalloc2(nthrmax uint32) *ParFor +func parforsetup2(desc *ParFor, nthr, n uint32, ctx *byte, wait bool, body func(*ParFor, uint32)) +func parfordo(desc *ParFor) +func parforiters(desc *ParFor, tid uintptr) (uintptr, uintptr) + +var NewParFor = parforalloc2 +var ParForSetup = parforsetup2 +var ParForDo = parfordo + +func ParForIters(desc *ParFor, tid uint32) (uint32, uint32) { + begin, end := parforiters(desc, uintptr(tid)) + return uint32(begin), uint32(end) +} |
