<divclass="platform-hinted "data-platform-hinted="data-platform-hinted"><divclass="content sourceset-dependent-content"data-active=""data-togglable=":micro_utils.dokka:dokkaHtml/commonMain"><divclass="symbol monospace"><spanclass="token keyword">interface </span><ahref="index.html">SmartMutex</a><spanclass="clearfix"><spanclass="floating-right">(<ahref="https://github.com/InsanusMokrassar/MicroUtils/blob/master//coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/SmartMutex.kt#L25">source</a>)</span></span></div><pclass="paragraph">It is interface which will work like classic <spandata-unresolved-link="kotlinx.coroutines.sync/Mutex///PointingToDeclaration/">Mutex</span>, but in difference have <ahref="lock-state-flow.html">lockStateFlow</a> for listening of the <ahref="index.html">SmartMutex</a> state.</p><pclass="paragraph">There is <ahref="-mutable/index.html">Mutable</a> and <ahref="-immutable/index.html">Immutable</a> realizations. In case you are owner and manager current state of lock, you need <ahref="index.html">Mutable</a>. Otherwise, <ahref="-immutable/index.html">Immutable</a>.</p><pclass="paragraph">Any <ahref="index.html">Mutable</a> may produce its <ahref="-immutable/index.html">Immutable</a> variant which will contains <ahref="lock-state-flow.html">lockStateFlow</a> equal to its <ahref="-mutable/index.html">Mutable</a> creator</p><h4class="">Inheritors</h4><divclass="table"><divclass="table-row"data-filterable-current=":micro_utils.dokka:dokkaHtml/commonMain"data-filterable-set=":micro_utils.dokka:dokkaHtml/commonMain"><divclass="main-subrow keyValue "><divclass=""><spanclass="inline-flex"><div><ahref="-immutable/index.html">Immutable</a></div></span></div><div></div></div></div><divclass="table-row"data-filterable-current=":micro_utils.dokka:dokkaHtml/commonMain"data-filterable-set=":micro_utils.dokka:dokkaHtml/commonMain"><divclass="main-subrow keyValue "><divclass=""><spanclass="inline-flex"><div><ahref="-mutable/index.html">Mutable</a></div></span></div><div></div></div></div></div></div></div>
<divclass="tabs-section"tabs-section="tabs-section"><buttonclass="section-tab"data-active=""data-togglable="CONSTRUCTOR,TYPE,PROPERTY,FUNCTION">Members</button><buttonclass="section-tab"data-togglable="CONSTRUCTOR,TYPE,PROPERTY,FUNCTION,EXTENSION_PROPERTY,EXTENSION_FUNCTION">Members & Extensions</button></div>
<divclass="copy-popup-wrapper "><spanclass="copy-popup-icon"></span><span>Link copied to clipboard</span></div>
</span></span></div>
<div>
<divclass="title">
<divclass="platform-hinted "data-platform-hinted="data-platform-hinted"><divclass="content sourceset-dependent-content"data-active=""data-togglable=":micro_utils.dokka:dokkaHtml/commonMain"><divclass="symbol monospace"><spanclass="token keyword">class </span><ahref="-mutable/index.html">Mutable</a><spanclass="token punctuation">(</span><spanclass="parameters "><spanclass="parameter ">locked<spanclass="token operator">: </span><ahref="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a><spanclass="token operator"> = </span><spanclass="token boolean">false</span></span></span><spanclass="token punctuation">)</span> : <ahref="index.html">SmartMutex</a></div><divclass="brief "><pclass="paragraph">Mutable variant of <ahref="index.html">SmartMutex</a>. With that variant you may <ahref="-mutable/lock.html">lock</a> and <ahref="-mutable/unlock.html">unlock</a>. Besides, you may create <ahref="-immutable/index.html">Immutable</a> variant of this instance with <ahref="-mutable/immutable.html">immutable</a> factory</p></div></div></div>
<divclass="copy-popup-wrapper "><spanclass="copy-popup-icon"></span><span>Link copied to clipboard</span></div>
</span></span></div>
<div>
<divclass="title">
<divclass="platform-hinted "data-platform-hinted="data-platform-hinted"><divclass="content sourceset-dependent-content"data-active=""data-togglable=":micro_utils.dokka:dokkaHtml/commonMain"><divclass="symbol monospace"><spanclass="token keyword">suspend </span><spanclass="token keyword">fun </span><ahref="index.html">SmartMutex</a><spanclass="token punctuation">.</span><ahref="../wait-unlock.html"><spanclass="token function">waitUnlock</span></a><spanclass="token punctuation">(</span><spanclass="token punctuation">)</span><spanclass="token operator">: </span><ahref="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></div><divclass="brief "><pclass="paragraph">Will wait until the <ahref="lock-state-flow.html">SmartMutex.lockStateFlow</a> of <spandata-unresolved-link="dev.inmo.micro_utils.coroutines//&lt;this&gt;/#/PointingToCallableParameters(-1)/">this</span> instance will be false.</p></div></div></div>