Skip to content

Commit dd52376

Browse files
committed
debug: ci debug
1 parent f8a7fd0 commit dd52376

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

src/Runtime/FiberCoroutine.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ public function start(): mixed
7474
try {
7575
$result = $this->fiber->start(...$this->args);
7676
} catch (Throwable $exception) {
77-
$this->result = $exception;
7877
$this->setState(Coroutine::STATE_DEAD);
7978
throw $exception;
8079
}
@@ -222,4 +221,14 @@ private function recycleReset(): void
222221
// 清空调试跟踪记录
223222
$this->clearTrace();
224223
}
224+
225+
/**
226+
*
227+
*/
228+
public function __destruct()
229+
{
230+
if (isset($this->fiber)) {
231+
Scheduler::remove($this->fiber);
232+
}
233+
}
225234
}

src/Runtime/Scheduler.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@ public static function start(Coroutine $coroutine): void
293293
new ControlResult('start', false, $coroutine, $exception);
294294
} finally {
295295
if ($coroutine->isTerminated()) {
296-
Scheduler::remove($coroutine->key());
297296
$coroutine->executeDefers();
298297
}
299298
}
@@ -316,7 +315,6 @@ public static function resume(Coroutine $coroutine, mixed $value = null): Contro
316315
return new ControlResult('resume', null, $coroutine, $exception);
317316
} finally {
318317
if ($coroutine->isTerminated()) {
319-
Scheduler::remove($coroutine->key());
320318
$coroutine->executeDefers();
321319
}
322320
}
@@ -339,7 +337,6 @@ public static function throw(Coroutine $coroutine, Throwable $exception): Contro
339337
return new ControlResult('resume', null, $coroutine, $exception);
340338
} finally {
341339
if ($coroutine->isTerminated()) {
342-
Scheduler::remove($coroutine->key());
343340
$coroutine->executeDefers();
344341
}
345342
}

tests/Sync/MutexTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ public function testConcurrentLockSafety(): void
262262
$coroutines[] = go(function () use ($mutex, &$counter, &$results, $i) {
263263
for ($j = 0; $j < 10; $j++) {
264264
$mutex->lock();
265-
Time::sleep(1); // 模拟一些工作
265+
Time::sleep(0.1); // 模拟一些工作
266266
$counter++;
267267
$mutex->unlock();
268268
}

0 commit comments

Comments
 (0)