From 1a40cd5a6585ac1def721bdd2657560993c25c58 Mon Sep 17 00:00:00 2001 From: matyhtf Date: Tue, 31 Dec 2024 11:41:16 +0800 Subject: [PATCH] Fix coroutine lock core tests, remove useless code. --filter=[core] --- core-tests/src/lock/lock.cpp | 2 +- ext-src/swoole_coroutine_lock.cc | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/core-tests/src/lock/lock.cpp b/core-tests/src/lock/lock.cpp index a5374d2e7d..a2da9992ed 100644 --- a/core-tests/src/lock/lock.cpp +++ b/core-tests/src/lock/lock.cpp @@ -140,7 +140,7 @@ TEST(lock, try_rd) { } TEST(lock, coroutine_lock) { - CoroutineLock *lock = new CoroutineLock(); + CoroutineLock *lock = new CoroutineLock(false); ASSERT_EQ(lock->lock(), SW_ERROR_CO_OUT_OF_COROUTINE); auto callback = [lock]() { coroutine::run([lock](void *arg) { diff --git a/ext-src/swoole_coroutine_lock.cc b/ext-src/swoole_coroutine_lock.cc index f51c9091f4..791ac90669 100644 --- a/ext-src/swoole_coroutine_lock.cc +++ b/ext-src/swoole_coroutine_lock.cc @@ -134,14 +134,3 @@ static PHP_METHOD(swoole_coroutine_lock, trylock) { CoroutineLock *lock = co_lock_get_and_check_ptr(ZEND_THIS); SW_LOCK_CHECK_RETURN(lock->trylock()); } - -static PHP_METHOD(swoole_coroutine_lock, trylock_read) { - CoroutineLock *lock = co_lock_get_and_check_ptr(ZEND_THIS); - SW_LOCK_CHECK_RETURN(lock->trylock_rd()); -} - -static PHP_METHOD(swoole_coroutine_lock, lock_read) { - CoroutineLock *lock = co_lock_get_and_check_ptr(ZEND_THIS); - SW_LOCK_CHECK_RETURN(lock->lock_rd()); -} -