Skip to content

v2.util #

fn WorkerPool.new #

fn WorkerPool.new[T, Y]() &WorkerPool[T, Y]

fn (WorkerPool[T, Y]) add_worker #

fn (mut wp WorkerPool[T, Y]) add_worker(t thread)

fn (WorkerPool[T, Y]) active_jobs #

fn (mut wp WorkerPool[T, Y]) active_jobs() int

fn (WorkerPool[T, Y]) get_job #

fn (mut wp WorkerPool[T, Y]) get_job() !T

fn (WorkerPool[T, Y]) push_result #

fn (mut wp WorkerPool[T, Y]) push_result(result Y)

fn (WorkerPool[T, Y]) job_done #

fn (mut wp WorkerPool[T, Y]) job_done()

fn (WorkerPool[T, Y]) queue_job #

fn (mut wp WorkerPool[T, Y]) queue_job(job T)

fn (WorkerPool[T, Y]) queue_jobs #

fn (mut wp WorkerPool[T, Y]) queue_jobs(jobs []T)

fn (WorkerPool[T, Y]) wait_for_results #

fn (mut wp WorkerPool[T, Y]) wait_for_results() []Y

struct WorkerPool #

struct WorkerPool[T, Y] {
mut:
	workers   []thread
	queue_len shared SharedIntWorkaround
	ch_in     chan T
	ch_out    chan Y
}