BloombergLP::bslmt::Once::enter

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

Synopsis

Declared in <bslmt_once.h>

bool
enter(OnceLock* onceLock);