mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: eliminate parfor ctx field
Prior to the conversion of the runtime to Go, this void* was necessary to get closure information in to C callbacks. There are no more C callbacks and parfor is perfectly capable of invoking a Go closure now, so eliminate ctx and all of its unsafe-ness. (Plus, the runtime currently doesn't use ctx for anything.) Change-Id: I39fc53b7dd3d7f660710abc76b0d831bfc6296d8 Reviewed-on: https://go-review.googlesource.com/3395 Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
This commit is contained in:
parent
8e2bb7bb4a
commit
ebbdf2a14c
4 changed files with 10 additions and 26 deletions
|
|
@ -41,7 +41,6 @@ type ParFor struct {
|
|||
Nthr uint32
|
||||
thrseq uint32
|
||||
Cnt uint32
|
||||
Ctx *byte
|
||||
wait bool
|
||||
}
|
||||
|
||||
|
|
@ -53,9 +52,9 @@ func NewParFor(nthrmax uint32) *ParFor {
|
|||
return desc
|
||||
}
|
||||
|
||||
func ParForSetup(desc *ParFor, nthr, n uint32, ctx *byte, wait bool, body func(*ParFor, uint32)) {
|
||||
func ParForSetup(desc *ParFor, nthr, n uint32, wait bool, body func(*ParFor, uint32)) {
|
||||
systemstack(func() {
|
||||
parforsetup((*parfor)(unsafe.Pointer(desc)), nthr, n, unsafe.Pointer(ctx), wait,
|
||||
parforsetup((*parfor)(unsafe.Pointer(desc)), nthr, n, wait,
|
||||
*(*func(*parfor, uint32))(unsafe.Pointer(&body)))
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue