func (mw *managedWorkloads) Iter() <-chan workload {
	c := make(chan workload)
	go func() {
		mw.RLock()
		defer mw.RUnlock()
		for _, mw := range mw.workloads {
			c <- mw
		}
		close(c)
	}()
	return c
}
Iter iterates over the workloads in the concurrent slice.
package gaiascheduler
import (
	"sync"
	"github.com/gaia-pipeline/gaia"
)
type workload struct {
	finishedSig chan bool
	done        bool
	started     bool
	job         *gaia.Job
}
type managedWorkloads struct {
	sync.RWMutex
	workloads []workload
}
func newManagedWorkloads() *managedWorkloads {
	mw := &managedWorkloads{
		workloads: make([]workload, 0),
	}
	return mw
}
func (mw *managedWorkloads) Append(wl workload) {
	mw.Lock()
	defer mw.Unlock()
	mw.workloads = append(mw.workloads, wl)
}
func (mw *managedWorkloads) GetByID(id uint32) *workload {
	var foundWorkload *workload
	for wl := range mw.Iter() {
		if wl.job.ID == id {
			copyWL := wl
			foundWorkload = &copyWL
		}
	}
	return foundWorkload
}
func (mw *managedWorkloads) Replace(wl workload) bool {
	mw.Lock()
	defer mw.Unlock()
	i := -1
	for id, currWL := range mw.workloads {
		if currWL.job.ID == wl.job.ID {
			i = id
			break
		}
	}
	if i == -1 {
		return false
	}
	mw.workloads[i] = wl
	return true
}