[#BloombergLP-bsls-BslOnceGuard-enter]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bsls.adoc[bsls]::xref:BloombergLP/bsls/BslOnceGuard.adoc[BslOnceGuard]::enter
:relfileprefix: ../../../
:mrdocs:

Enter the one&hyphen;time block of code that is managed by the specified `once`&period; Return `true` if the one&hyphen;time block of code has been entered, and `false` if the one&hyphen;time block of code has already been executed&period; If this function returns `false` then the thread of execution in which `enter` returned `true` has already called `leave` &hyphen;&hyphen; i&period;e&period;, the one&hyphen;time block of code is guaranteed to have _completed_ execution&period; The behavior is undefined unless `once` was originally initialized to `BSLS&lowbar;BSLONCE&lowbar;INITIALIZER`&period; Note that a successful `enter` locks a spin&hyphen;lock&semi; it is imperative that `leave` be called quickly&period;

== Synopsis

Declared in `&lt;bsls&lowbar;bslonce&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
bool
enter(xref:BloombergLP/bsls/BslOnce.adoc[BslOnce]* once);
----


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