[#BloombergLP-bdlmt-ThreadPool-enqueueJob-04]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlmt.adoc[bdlmt]::xref:BloombergLP/bdlmt/ThreadPool.adoc[ThreadPool]::enqueueJob
:relfileprefix: ../../../
:mrdocs:

Enqueue `function` with `userData` for execution by a worker thread&period;

== Synopsis

Declared in `&lt;bdlmt&lowbar;threadpool&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
enqueueJob(
    xref:BloombergLP/bdlmt/ThreadPoolJobFunc.adoc[ThreadPoolJobFunc] function,
    void* userData);
----

== Description

Enqueue the specified `function` to be executed by the next available thread&period; The specified `userData` pointer will be passed to the function by the processing thread&period; Return 0 if enqueued successfully, and a non&hyphen;zero value if queuing is currently disabled&period;

== Return Value

0 if enqueued successfully, and a non&hyphen;zero value if queuing is disabled

== 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]#
