BloombergLP::bdlmt::MultipriorityThreadPool::enqueueJob

Enqueue a C-style job function at the specified priority.

Synopsis

Declared in <bdlmt_multiprioritythreadpool.h>

int
enqueueJob(
    bslmt_ThreadFunction jobFunction,
    void* jobData,
    int priority);

Description

Add a job to the queue of this multi-priority thread pool indicated by the specified jobFunction and associated jobData, assigning it the specified priority. Return 0 if the job was enqueued successfully, and a non-zero value otherwise (implying that the queue was in the disabled state). When invoked, jobFunction is passed the void * address jobData as its only argument. The behavior is undefined unless jobFunction is non-null and 0 <= priority < numPriorities(). Note that jobData may be 0 as long as jobFunction supports that value.

Return Value

0 if the job was enqueued, and a non-zero value otherwise

Parameters

NameDescription
jobFunctionC-style function invoked as the job
jobDatapointer passed as the sole argument to jobFunction
priorityjob priority; 0 is most urgent