libapa...dMutex(3pm)
π NAME π
APR::ThreadMutex β the Perl API for APR thread mutexes, bestie. It's giving "let's keep our threads from stepping on each other's toes" β¨
πΈ Synopsis πΈ
use APR::ThreadMutex ();
my $mutex = APR::ThreadMutex->new($r->pool);
$mutex->lock;
$mutex->unlock;
$mutex->trylock;
π¦ Description π¦
APR::ThreadMutex is literally the Perl doorway into APR thread mutexes. That's the whole vibe. π
π API π
APR::ThreadMutex hands you these functions and/or methods, and yes we're going through every single one:
π«Ά Unsupported API π«Ά
okay so listen β APR::ThreadMutex also has an auto-generated Perl interface for a handful of other methods. And here's the tea: those ones aren't tested at the moment, so their API is a subject to change. They'll get finalized later when a need arises, no cap. If you're planning to rely on any of the methods below, pls pls pls contact the mod_perl development mailing list so we can all help each other take the steps necessary to shift that method over to an officially supported API. Teamwork, periodt. π
π DESTROY
META: Autogenerated β needs to be reviewed/completed
Destroy the mutex and free the memory associated with the lock. It's the little goodbye moment. π
$mutex->DESTROY();
- obj:
$mutex(APR::ThreadMutex object) β the mutex to destroy. - ret: no return value
- since: subject to change
π₯ lock
META: Autogenerated β needs to be reviewed/completed
Acquire the lock for the given mutex. If that mutex is already locked, the current thread gets put to sleep until the lock becomes available. It's napping until its turn, honestly iconic. π΄
$ret = $mutex->lock();
- obj:
$mutex(APR::ThreadMutex object) β the mutex on which to acquire the lock. - ret:
$ret( integer ) - since: subject to change
β new
Create a new mutex. Fresh mutex, main character energy. π
my $mutex = APR::ThreadMutex->new($p);
- obj:
APR::ThreadMutex( class name ) - arg1:
$p(APR::Pool object) - ret:
$mutex(APR::ThreadMutex object) - since: subject to change
π pool_get
META: Autogenerated β needs to be reviewed/completed
META: should probably be renamed to pool(), like all other pool accessors
Get the pool used by this thread_mutex. Get you a pool that does this. π
$ret = $obj->pool_get();
- obj:
$obj(APR::ThreadMutex object) - ret:
$ret(APR::Pool object) βapr_pool_tthe pool - since: subject to change
β¨ trylock
META: Autogenerated β needs to be reviewed/completed
Attempt to acquire the lock for the given mutex. If the mutex has already been acquired, the call returns immediately with APR_EBUSY. No waiting, no drama, just "busy bestie, try again later." π
Note: it is important that theAPR_STATUS_IS_EBUSY(s)macro be used to determine if the return value wasAPR_EBUSY, for portability reasons. Like, important important. Don't skip this one. π
$ret = $mutex->trylock();
- obj:
$mutex(APR::ThreadMutex object) β the mutex on which to attempt the lock acquiring. - ret:
$ret(integer) - since: subject to change
π unlock
META: Autogenerated β needs to be reviewed/completed
Release the lock for the given mutex. Let it gooooo. π¦
$ret = $mutex->unlock();
- obj:
$mutex(APR::ThreadMutex object) β the mutex from which to release the lock. - ret:
$ret( integer ) - since: subject to change
πΈ See Also πΈ
mod_perl 2.0 documentation. Go read it, iykyk. π«Ά
π Copyright π
mod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 2.0.
π Authors π
The mod_perl development team and numerous contributors.
okay that's the whole page bestie, you ate π
This was pulled from the perl v5.42.3 docs, dated 2026-08-20 β blow it a kiss goodbye, she's done. πβ¨
π¦ where this page comes from
- ubuntu stonking: libapache2-mod-perl2 2.0.13-2build3 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms