[#BloombergLP-bslmt-ThreadUtil-setThreadLimit]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::xref:BloombergLP/bslmt/ThreadUtil.adoc[ThreadUtil]::setThreadLimit
:relfileprefix: ../../../
:mrdocs:

Enable a thread creation limit&period; If set to non&hyphen;zero value `n`&apos;th thread creation will fail&period; The limit is disabled by setting the limit to 0&period; Only intended to be used in tests to inject thread creation errors&period; Note that this can be called multiple times to reset the thread limit, e&period;g&period; between subtests for example&period;

== Synopsis

Declared in `&lt;bslmt&lowbar;threadutil&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
void
setThreadLimit(unsigned int n);
----


[.small]#Created with https://www.mrdocs.com[MrDocs]#
