[#BloombergLP-bslmt-ThreadUtil-createWithAllocator-0a] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::xref:BloombergLP/bslmt/ThreadUtil.adoc[ThreadUtil]::createWithAllocator :relfileprefix: ../../../ :mrdocs: `createWithAllocator` overloads == Synopses Declared in `<bslmt_threadutil.h>` Create a thread that invokes a function object using an allocator. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class INVOKABLE> static int xref:BloombergLP/bslmt/ThreadUtil/createWithAllocator-0d7.adoc[createWithAllocator]( xref:BloombergLP/bslmt/ThreadUtil/Handle.adoc[Handle]* handle, INVOKABLE const& function, xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* allocator); ---- [.small]#xref:BloombergLP/bslmt/ThreadUtil/createWithAllocator-0d7.adoc[_» more..._]# Create a thread that runs the specified entry‐point using an allocator. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static int xref:BloombergLP/bslmt/ThreadUtil/createWithAllocator-0c.adoc[createWithAllocator]( xref:BloombergLP/bslmt/ThreadUtil/Handle.adoc[Handle]* handle, xref:BloombergLP/bslmt/ThreadUtil/ThreadFunction.adoc[ThreadFunction] function, void* userData, xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* allocator); ---- [.small]#xref:BloombergLP/bslmt/ThreadUtil/createWithAllocator-0c.adoc[_» more..._]# Same as the preceding overload, with the specified `attributes`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class INVOKABLE> static int xref:BloombergLP/bslmt/ThreadUtil/createWithAllocator-05.adoc[createWithAllocator]( xref:BloombergLP/bslmt/ThreadUtil/Handle.adoc[Handle]* handle, xref:BloombergLP/bslmt/ThreadAttributes.adoc[ThreadAttributes] const& attributes, INVOKABLE const& function, xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* allocator); ---- [.small]#xref:BloombergLP/bslmt/ThreadUtil/createWithAllocator-05.adoc[_» more..._]# Create a thread with the specified `attributes` and `allocator`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static int xref:BloombergLP/bslmt/ThreadUtil/createWithAllocator-0db.adoc[createWithAllocator]( xref:BloombergLP/bslmt/ThreadUtil/Handle.adoc[Handle]* handle, xref:BloombergLP/bslmt/ThreadAttributes.adoc[ThreadAttributes] const& attributes, xref:BloombergLP/bslmt/ThreadUtil/ThreadFunction.adoc[ThreadFunction] function, void* userData, xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* allocator); ---- [.small]#xref:BloombergLP/bslmt/ThreadUtil/createWithAllocator-0db.adoc[_» more..._]# == Return Value 0 on success, and a non‐zero value otherwise == Parameters [cols="1,4"] |=== | Name| Description | *handle* | receives an identifier for the new thread | *function* | invokable object executed as the thread entry point | *allocator* | memory allocator used to copy `function` | *userData* | sole argument passed to `function` | *attributes* | properties for the new thread |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#