SyncSemaphore::__construct

(PECL sync >= 1.0.0)

SyncSemaphore::__constructConstructs a new SyncSemaphore object

Beschreibung

public SyncSemaphore::__construct(string $name = ?, int $initialval = 1, bool $autounlock = true)

Constructs a named or unnamed semaphore.

Parameter-Liste

name

The name of the semaphore if this is a named semaphore object.

Hinweis:

If the name already exists, it must be able to be opened by the current user that the process is running as or an exception will be thrown with a meaningless error message.

initialval

The initial value of the semaphore. This is the number of locks that may be obtained.

autounlock

Specifies whether or not to automatically unlock the semaphore at the conclusion of the PHP script.

Warnung

If an object is: A named semaphore with an autounlock of false, the object is locked, and the PHP script concludes before the object is unlocked, then the underlying semaphore will end up in an inconsistent state.

Rückgabewerte

The new SyncSemaphore object.

Fehler/Exceptions

An exception is thrown if the semaphore cannot be created or opened.

Beispiele

Beispiel #1 SyncSemaphore::__construct() example

<?php
$semaphore 
= new SyncSemaphore("LimitedResource_2clients"2);

if (!
$semaphore->lock(3000))
{
    echo 
"Unable to lock semaphore.";

    exit();
}

/* ... */

$semaphore->unlock();
?>

Siehe auch

Hier Kannst Du einen Kommentar verfassen


Bitte gib mindestens 10 Zeichen ein.
Wird geladen... Bitte warte.
* Pflichtangabe
Es sind noch keine Kommentare vorhanden.

Was genau bedeutet "Vibe Coding"? Ein tiefgehender Blick für Entwickler

In der Welt der Softwareentwicklung gibt es unzählige Wege, wie man an ein Projekt herangeht. Manche schwören auf strikte Planung, andere auf bewährte Algorithmen und wieder andere lassen sich von etwas ganz anderem leiten: ihrem Gefühl. ...

admin

Autor : admin
Kategorie: Software & Web-Development

PHP cURL-Tutorial: Verwendung von cURL zum Durchführen von HTTP-Anfragen

cURL ist eine leistungsstarke PHP-Erweiterung, die es Ihnen ermöglicht, mit verschiedenen Servern über verschiedene Protokolle wie HTTP, HTTPS, FTP und mehr zu kommunizieren. ...

TheMax

Autor : TheMax
Kategorie: PHP-Tutorials

Midjourney Tutorial - Anleitung für Anfänger

Über Midjourney, dem Tool zur Erstellung digitaler Bilder mithilfe von künstlicher Intelligenz, gibt es ein informatives Video mit dem Titel "Midjourney Tutorial auf Deutsch - Anleitung für Anfänger" ...

Mike94

Autor : Mike94
Kategorie: KI Tutorials

Tutorial veröffentlichen

Tutorial veröffentlichen

Teile Dein Wissen mit anderen Entwicklern weltweit

Du bist Profi in deinem Bereich und möchtest dein Wissen teilen, dann melde dich jetzt an und teile es mit unserer PHP-Community

mehr erfahren

Tutorial veröffentlichen

yrica Rabatt. Rabatt kaufen Lyrica - wie kaufe ich Over the Counter Lyrica. Köln — D

Rabatt Lyrica. Rabatt kaufen Lyrica Sie suchen erstklassige Medikamente, ohne das Haus zu verlassen? Suchen Sie nicht weiter! Unser vertrauenswür ...

Geschrieben von drawer am 20.06.2026 07:51:15
Forum: Fragen/Vorschläge zum Forum
évothyroxine Sans ordonnance. Lévothyroxine Pharmacie En Ligne - Lévothyroxine Pas C

Sans ordonnance Lévothyroxine. Lévothyroxine Pharmacie En Ligne Avez besoin de médicaments de haute qualité ? Nous sommes là pour vous ! Notr ...

Geschrieben von drawer am 20.06.2026 07:50:43
Forum: IT-Security
opiclone Koop goedkoop. Zopiclone Bestel online - Zopiclone goedkoop bestellen. La L

Koop goedkoop Zopiclone. Zopiclone Bestel online Op zoek naar eersteklas medicijnen zonder dat u uw huis hoeft te verlaten? Zoek niet verder! Onze ...

Geschrieben von travelder am 20.06.2026 07:50:39
Forum: Projekthilfe
odafinilo En línea. cuanto cuesta el Modafinilo gotas - comprar Modafinilo barcelona

En línea Modafinilo. cuanto cuesta el Modafinilo gotas ¿Necesita medicamentos confiables y de alta calidad, pero no quiere salir de casa para co ...

Geschrieben von travelder am 20.06.2026 07:50:07
Forum: Entwicklungsumgebungen