Documentation
¶
Index ¶
Constants ¶
View Source
const ( InvalidJob = JobStatus(iota) // Could not find job Enqueued = JobStatus(iota) // In the queue, waiting to run Running = JobStatus(iota) // Running Terminated = JobStatus(iota) // Error/forced quit Completed = JobStatus(iota) // Completed successfully )
* The different statuses of a Job
Variables ¶
View Source
var (
MinWorkPerThread = 16 * 1024
)
Functions ¶
func Foreach ¶
Foreach mimics a parallel foreach construct
This code should be equivalent to the serial code:
for i := 0 ; i < iterations; i++ {
f(i);
}
@f - Function to call in each iteration of the for loop
@iterations - How many iterations we should perform
func StatusByName ¶
StatusByName returns a status value by its string representation
Types ¶
type IterableJob ¶
type IterableJob struct {
// contains filtered or unexported fields
}
IterableJob represents the work performed in a loop
func (*IterableJob) GetID ¶
func (j *IterableJob) GetID() int
GetID returns the id for this job.
If the job has been submitted to the runtime then this ID has been set to some internal ID
func (*IterableJob) GetName ¶
func (j *IterableJob) GetName() string
GetName will return the user given name of this job
func (*IterableJob) Next ¶
func (j *IterableJob) Next() bool
Next will try to perform the next operation for this job
func (*IterableJob) SetID ¶
func (j *IterableJob) SetID(id int)
SetID sets the ID if it has not been set previously
type Runtime ¶
type Runtime interface {
// StartJob starts a job and returns a UID
// for the job
StartJob(job Job) int
// StopJob stops the given job
StopJob(jobID int) bool
// JobStatus returns the status of the job
JobStatus(jobID int) JobStatus
// Start the parallels runtime
Start()
// Stop the parallels runtime
Stop()
}
Runtime handles the parallels runtime
Click to show internal directories.
Click to hide internal directories.