#lang scribble/manual @(require (for-label scheme/base scheme/gui scheme/contract "main.ss")) @title{Job Queue} @author{@(author+email "Jay McCarthy" "jay@plt-scheme.org")} A multi-threaded job queue. @defmodule[(planet jaymccarthy/job-queue)] @defproc[(job-queue? [v any/c]) boolean?] Returns true if @scheme[v] is a job queue. @defproc[(make-job-queue [how-many-workers exact-nonnegative-integer?]) job-queue?] Starts a queue with @scheme[how-many-workers] threads servicing jobs. @defproc[(submit-job! [jq job-queue?] [job (-> any)]) void] Runs @scheme[job] by one of @scheme[jq]'s workers. @scheme[job] is run in the same parameterization as the call to @scheme[submit-job!]. This call will never block. @defproc[(stop-job-queue! [jq job-queue?]) void] Blocks until all of @scheme[jq]'s current jobs are finished and its workers are dead. Once @scheme[stop-job-queue!] has been called, @scheme[jq] will reject subsequent requests and @scheme[submit-job!] will block indefinitely.