[#BloombergLP-bdlmt-FixedThreadPool-enqueueJob-03] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlmt.adoc[bdlmt]::xref:BloombergLP/bdlmt/FixedThreadPool.adoc[FixedThreadPool]::enqueueJob :relfileprefix: ../../../ :mrdocs: Enqueue `function` with `userData` for execution by a worker thread. == Synopsis Declared in `<bdlmt_fixedthreadpool.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- int enqueueJob( xref:BloombergLP/bdlmt/FixedThreadPoolJobFunc.adoc[FixedThreadPoolJobFunc] function, void* userData); ---- == Description Enqueue the specified `function` to be executed by the next available thread. The specified `userData` pointer will be passed to the function by the processing thread. Return 0 on success, and a non‐zero value otherwise. Specifically, return `e_SUCCESS` on success, `e_DISABLED` if `!isEnabled()`, and `e_FAILED` if an error occurs. This operation will block if there is not sufficient capacity in the underlying queue until there is free capacity to successfully enqueue this job. Threads blocked (on enqueue methods) due to the underlying queue being full will unblock and return `e_DISABLED` if `disable` is invoked (on another thread). The behavior is undefined unless `function` is not null. == Return Value 0 on success, and a non‐zero value otherwise == Parameters [cols="1,4"] |=== | Name| Description | *function* | job function to enqueue | *userData* | opaque pointer passed to `function` |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#