Thread::Semaphore

Thread::Semaphore

NAME

Thread::Semaphore - Thread-safe semaphores

VERSION

This document describes Thread::Semaphore version 2.12

SYNOPSIS

use Thread::Semaphore;
my $s = Thread::Semaphore->new();
$s->down();   # Also known as the semaphore P operation.
# The guarded section is here
$s->up();     # Also known as the semaphore V operation.

# Decrement the semaphore only if it would immediately succeed.
if ($s->down_nb()) {
    # The guarded section is here