GoLang SyncMutex::__construct

request it (291)
GoLang replacement for PHP's SyncMutex::__construct [edit | history]

Do you know a GoLang replacement for PHP's SyncMutex::__construct? Write it!

PHP SyncMutex::__construct

PHP original manual for SyncMutex::__construct [ show | php.net ]


(PECL sync >= 1.0.0)

SyncMutex::__constructConstructs a new SyncMutex object


public SyncMutex::__construct ([ string $name ] )

Constructs a named or unnamed countable mutex.



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


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.

Return Values

The new SyncMutex object. An exception is thrown if the mutex cannot be created or opened.


Example #1 SyncMutex::__construct() named mutex with lock timeout example

= new SyncMutex("UniqueName");

if (!
"Unable to lock mutex.";


/* ... */


Example #2 SyncMutex::__construct() unnamed mutex example

= new SyncMutex();


/* ... */


See Also