Skip to content

Conversation

@onairmarc
Copy link
Member

This pull request introduces a new in-memory lock utility to the codebase, providing a mechanism for safely executing code while ensuring mutual exclusion on named resources. It also adds a custom exception for lock acquisition timeouts.

Concurrency control:

  • Added a new Lock class in src/Objects/Support/Lock.php that provides static methods to acquire, release, and check named locks, as well as a block method to execute callbacks while holding a lock. This helps prevent race conditions when accessing shared resources.

Error handling:

  • Introduced a custom LockTimeoutException in src/Exceptions/LockTimeoutException.php to be thrown when a lock cannot be acquired within the specified timeout period, improving error reporting and debugging for lock-related issues.

@onairmarc onairmarc merged commit c4a26ba into main Jan 17, 2026
@onairmarc onairmarc deleted the locks branch January 17, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants