<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.swoole-coroutine-lock.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'swoole-coroutine-lock.trylock.php',
    1 => 'Swoole\\Coroutine\\Lock::trylock',
    2 => 'Attempt to acquire the lock without blocking',
  ),
  'up' => 
  array (
    0 => 'class.swoole-coroutine-lock.php',
    1 => 'Swoole\\Coroutine\\Lock',
  ),
  'prev' => 
  array (
    0 => 'swoole-coroutine-lock.lock.php',
    1 => 'Swoole\\Coroutine\\Lock::lock',
  ),
  'next' => 
  array (
    0 => 'swoole-coroutine-lock.unlock.php',
    1 => 'Swoole\\Coroutine\\Lock::unlock',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/swoole/swoole/coroutine/lock/trylock.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="swoole-coroutine-lock.trylock" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Swoole\Coroutine\Lock::trylock</h1>
  <p class="verinfo">(No version information available, might only be in Git)</p><p class="refpurpose"><span class="refname">Swoole\Coroutine\Lock::trylock</span> &mdash; <span class="dc-title">Attempt to acquire the lock without blocking</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-swoole-coroutine-lock.trylock-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>Swoole\Coroutine\Lock::trylock</strong></span>(): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   When calling the lock operation, if the lock is already held by another coroutine,
   the function will immediately return false without suspending the current coroutine
   or yielding CPU control. This non-blocking design allows the caller to flexibly
   handle contention situations, such as retrying, giving up, or executing other logic.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-swoole-coroutine-lock.trylock-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">This function has no parameters.</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-swoole-coroutine-lock.trylock-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns <code class="literal">true</code> if the lock was acquired successfully,
   <code class="literal">false</code> if the lock is not available.
  </p>
 </div>

</div><?php manual_footer($setup); ?>