-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess.go
More file actions
23 lines (18 loc) · 769 Bytes
/
process.go
File metadata and controls
23 lines (18 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Package parallel provides objects for executing parallel operations on either
// a fixed or variable number of goroutines.
package parallel
// Operation types represent a single operation in a parallel process.
// Responders should perform the i-th operation.
type Operation func(i int)
// Process types execute a specified number of operations on a given number of
// goroutines.
type Process interface {
// Execute executes a parallel process for the given number of iterations
// using the provided operation function.
Execute(iterations int, operation Operation)
// Stop stops the process if it is currently executing.
Stop()
// NumRoutines returns the number of routines that are currently executing in
// the parallel process.
NumRoutines() int
}