Skip to content

Commit bbbde61

Browse files
Applamatyhtf
authored andcommitted
fix time cast for lockwait (#5862)
1 parent 59f265b commit bbbde61

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

ext-src/swoole_lock.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ static PHP_METHOD(swoole_lock, lockwait) {
186186
zend_throw_exception(swoole_exception_ce, "wrong lock type", -3);
187187
RETURN_FALSE;
188188
}
189-
SW_LOCK_CHECK_RETURN(mutex->lock_wait((int) timeout * 1000));
189+
SW_LOCK_CHECK_RETURN(mutex->lock_wait((int) (timeout * 1000)));
190190
}
191191

192192
static PHP_METHOD(swoole_lock, unlock) {

tests/swoole_lock/lockwait_twice.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Assert::false($ret);
1616
$end = microtime(true);
1717

1818
Assert::eq($lock->errCode, SOCKET_ETIMEDOUT);
19-
Assert::lessThan($end - $start, 0.2);
19+
Assert::greaterThanEq($end - $start, 0.2);
2020

2121
?>
2222
--EXPECT--

0 commit comments

Comments
 (0)