mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: move all parfor-related code to parfor.go
This cleanup was slated for after the conversion of the runtime to Go. Also improve type and function documentation. Change-Id: I55a16b09e00cf701f246deb69e7ce7e3e04b26e7 Reviewed-on: https://go-review.googlesource.com/3393 Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
This commit is contained in:
parent
7a71726b1f
commit
6b7b0f9a0c
3 changed files with 41 additions and 38 deletions
|
|
@ -439,27 +439,6 @@ type lfnode struct {
|
|||
pushcnt uintptr
|
||||
}
|
||||
|
||||
// Parallel for descriptor.
|
||||
type parfor struct {
|
||||
body unsafe.Pointer // go func(*parfor, uint32), executed for each element
|
||||
done uint32 // number of idle threads
|
||||
nthr uint32 // total number of threads
|
||||
nthrmax uint32 // maximum number of threads
|
||||
thrseq uint32 // thread id sequencer
|
||||
cnt uint32 // iteration space [0, cnt)
|
||||
ctx unsafe.Pointer // arbitrary user context
|
||||
wait bool // if true, wait while all threads finish processing,
|
||||
// otherwise parfor may return while other threads are still working
|
||||
thr *parforthread // array of thread descriptors
|
||||
pad uint32 // to align parforthread.pos for 64-bit atomic operations
|
||||
// stats
|
||||
nsteal uint64
|
||||
nstealcnt uint64
|
||||
nprocyield uint64
|
||||
nosyield uint64
|
||||
nsleep uint64
|
||||
}
|
||||
|
||||
// Track memory allocated by code not written in Go during a cgo call,
|
||||
// so that the garbage collector can see them.
|
||||
type cgomal struct {
|
||||
|
|
@ -629,15 +608,6 @@ var (
|
|||
* so they can be garbage collected if there are no other pointers to nodes.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Parallel for over [0, n).
|
||||
* body() is executed for each iteration.
|
||||
* nthr - total number of worker threads.
|
||||
* ctx - arbitrary user context.
|
||||
* if wait=true, threads return from parfor() when all work is done;
|
||||
* otherwise, threads can return while other threads are still finishing processing.
|
||||
*/
|
||||
|
||||
// for mmap, we only pass the lower 32 bits of file offset to the
|
||||
// assembly routine; the higher bits (if required), should be provided
|
||||
// by the assembly routine as 0.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue