[#BloombergLP-bslmt-Once-enter]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::xref:BloombergLP/bslmt/Once.adoc[Once]::enter
:relfileprefix: ../../../
:mrdocs:

Lock the internal mutex using the specified `onceLock` (possibly blocking if another thread has already locked the mutex)&period; If no other thread has yet called `enter` or `callOnce` on this object, return `true`&period; Otherwise, unlock the mutex and return `false`&period; The mutex lock may be skipped if it can be determined that it will not be needed&period; The behavior is undefined if `onceLock` is already in a locked state on entry to this method&period; Note that if `enter` returns `true`, the caller _must_ eventually call `leave`, or else other threads may block indefinitely&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
bool
enter(xref:BloombergLP/bslmt/Once/OnceLock.adoc[OnceLock]* onceLock);
----


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