[#BloombergLP-bslmt-ThreadUtilImpl-04-create-09] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::xref:BloombergLP/bslmt/ThreadUtilImpl-04.adoc[ThreadUtilImpl<Platform::PosixThreads>]::create :relfileprefix: ../../../ :mrdocs: `create` overloads == Synopses Declared in `<bslmt_threadutilimpl_pthread.h>` Create a new thread of program control having platform specific default attributes (i.e., "stack size", "scheduling priority"), that invokes the specified `function` with a single argument specified by `userData`, and load into the specified `threadHandle`, an identifier that may be used to refer to the thread in future calls to this utility. Return 0 on success, and a non‐zero value otherwise. The behavior is undefined if the `threadHandle` is 0. Note that unless explicitly "detached" (`detach`), a call to `join` must be made once the thread terminates to reclaim any system resources associated with the newly created identifier. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static int xref:BloombergLP/bslmt/ThreadUtilImpl-04/create-0f.adoc[create]( xref:BloombergLP/bslmt/ThreadUtilImpl-04/Handle.adoc[Handle]* threadHandle, xref:BloombergLP/bslmt_ThreadFunction.adoc[bslmt_ThreadFunction] function, void* userData); ---- [.small]#xref:BloombergLP/bslmt/ThreadUtilImpl-04/create-0f.adoc[_» more..._]# Create a new thread of program control having the specified `attributes` that invokes the specified `function` with a single argument specified by `userData`, and load into the specified `threadHandle` an identifier that may be used to refer to the thread in future calls to this utility. Return 0 on success, and a non‐zero value otherwise. The behavior is undefined if the specified `thread` is 0 or if `attributes.stackSize()` has been set to a negative value other than the unset value. Note that unless explicitly "detached" (by `detach`), or unless the `BSLMT_CREATE_DETACHED` attribute is specified, a call to `join` must be made once the thread terminates to reclaim any system resources associated with the newly created identifier. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static int xref:BloombergLP/bslmt/ThreadUtilImpl-04/create-08.adoc[create]( xref:BloombergLP/bslmt/ThreadUtilImpl-04/Handle.adoc[Handle]* threadHandle, xref:BloombergLP/bslmt/ThreadAttributes.adoc[ThreadAttributes] const& attributes, xref:BloombergLP/bslmt_ThreadFunction.adoc[bslmt_ThreadFunction] function, void* userData); ---- [.small]#xref:BloombergLP/bslmt/ThreadUtilImpl-04/create-08.adoc[_» more..._]# [.small]#Created with https://www.mrdocs.com[MrDocs]#