Skip to content

Commit 3613ebd

Browse files
committed
php#64: Refactor deadlock detection to use structured exceptions instead of warnings
- Add new Async\DeadlockError exception class extending Error - Replace multiple async_warning() calls with single structured exception - Implement proper exit_exception handling for inter-coroutine safety - Update resolve_deadlocks() to set ZEND_ASYNC_EXIT_EXCEPTION correctly - Add ZEND_ASYNC_EXCEPTION_DEADLOCK to async class enum (ID: 36) - Extend async_get_class_ce() to support new exception type - Update all deadlock tests to expect exception instead of warnings - Fix memory leak by removing unnecessary GC_ADDREF calls This change improves error handling by providing a single, catchable DeadlockError exception instead of multiple warnings, while maintaining proper coroutine cancellation behavior through exit_exception mechanism. Tests updated: - 001-deadlock-basic-test.phpt - 002-deadlock-with-catch.phpt - 003-deadlock-with-zombie.phpt - 010-deadlock-after-cancel-with-zombie.phpt
1 parent d10813d commit 3613ebd

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Zend/zend_async_API.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ typedef enum {
132132
ZEND_ASYNC_EXCEPTION_INPUT_OUTPUT = 33,
133133
ZEND_ASYNC_EXCEPTION_POLL = 34,
134134
ZEND_ASYNC_EXCEPTION_DNS = 35,
135+
ZEND_ASYNC_EXCEPTION_DEADLOCK = 36,
135136
} zend_async_class;
136137

137138
/**

0 commit comments

Comments
 (0)