Reference documentation and code samples for the Google Cloud PHP shared dependency, providing functionality useful to all components. Client class SemaphoreLock.
Semaphore based lock implementation.
Namespace
Google \ Cloud \ Core \ Lock
Methods
__construct
Parameter
Name
Description
key
int
A key.
acquire
Acquires a lock that will block until released.
Parameters
Name
Description
options
array
Configuration options.
↳ blocking
bool
Whether the process should block while waiting to acquire the lock.Defaults totrue.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Google Cloud PHP shared dependency, providing functionality useful to all components. Client - Class SemaphoreLock (1.64.2)\n\nVersion latestkeyboard_arrow_down\n\n- [1.64.2 (latest)](/php/docs/reference/cloud-core/latest/Lock.SemaphoreLock)\n- [1.64.1](/php/docs/reference/cloud-core/1.64.1/Lock.SemaphoreLock)\n- [1.63.0](/php/docs/reference/cloud-core/1.63.0/Lock.SemaphoreLock)\n- [1.62.3](/php/docs/reference/cloud-core/1.62.3/Lock.SemaphoreLock)\n- [1.61.0](/php/docs/reference/cloud-core/1.61.0/Lock.SemaphoreLock)\n- [1.60.1](/php/docs/reference/cloud-core/1.60.1/Lock.SemaphoreLock)\n- [1.59.1](/php/docs/reference/cloud-core/1.59.1/Lock.SemaphoreLock)\n- [1.58.2](/php/docs/reference/cloud-core/1.58.2/Lock.SemaphoreLock)\n- [1.53.0](/php/docs/reference/cloud-core/1.53.0/Lock.SemaphoreLock)\n- [1.52.11](/php/docs/reference/cloud-core/1.52.11/Lock.SemaphoreLock)\n- [1.51.2](/php/docs/reference/cloud-core/1.51.2/Lock.SemaphoreLock)\n- [1.50.0](/php/docs/reference/cloud-core/1.50.0/Lock.SemaphoreLock)\n- [1.49.3](/php/docs/reference/cloud-core/1.49.3/Lock.SemaphoreLock)\n- [1.48.1](/php/docs/reference/cloud-core/1.48.1/Lock.SemaphoreLock) \n| **Beta**\n|\n|\n| This library is covered by the [Pre-GA Offerings Terms](/terms/service-terms#1)\n| of the Terms of Service. Pre-GA libraries might have limited support,\n| and changes to pre-GA libraries might not be compatible with other pre-GA versions.\n| For more information, see the\n[launch stage descriptions](/products#product-launch-stages). \nReference documentation and code samples for the Google Cloud PHP shared dependency, providing functionality useful to all components. Client class SemaphoreLock.\n\nSemaphore based lock implementation.\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Core \\\\ Lock\n\nMethods\n-------\n\n### __construct\n\n### acquire\n\nAcquires a lock that will block until released.\n\n### release\n\nReleases the lock."]]