| 243 | } |
| 244 | |
| 245 | void GCDDispatchQueue::fullTeardown() { |
| 246 | teardown(); |
| 247 | |
| 248 | // Try to acquire the execution lock with timeout to ensure no tasks are executing |
| 249 | // If we can acquire it, all tasks have completed. If timeout, proceed anyway to |
| 250 | // avoid indefinite hang (preserves COMPOSER-837 JSCore deadlock workaround). |
| 251 | if (!_executionMutex.try_lock_for(std::chrono::seconds(2))) { |
| 252 | // Timeout - log and proceed anyway |
| 253 | // This should be rare and indicates tasks are taking too long to complete |
| 254 | } else { |
| 255 | // Successfully acquired lock - all tasks complete, release it |
| 256 | _executionMutex.unlock(); |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | bool GCDDispatchQueue::wasDestroyed() const { |
| 261 | return _destroyed.load(); |
no test coverage detected