From 01e5eaea12a070aa6b6aa72d6687790e508da1be Mon Sep 17 00:00:00 2001 From: kailixu Date: Thu, 28 Mar 2024 08:19:58 +0800 Subject: [PATCH] enh: remove obsolete code --- source/os/src/osThread.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/source/os/src/osThread.c b/source/os/src/osThread.c index 0dd5374cf0..3e2d4110eb 100644 --- a/source/os/src/osThread.c +++ b/source/os/src/osThread.c @@ -17,15 +17,6 @@ #include #include "os.h" -#ifdef WINDOWS -#define THREAD_PTR_CHECK(p) \ - do { \ - if (!(p) || !(*(p))) return 0; \ - } while (0); -#else -#define THREAD_PTR_CHECK(p) -#endif - int32_t taosThreadCreate(TdThread *tid, const TdThreadAttr *attr, void *(*start)(void *), void *arg) { return pthread_create(tid, attr, start, arg); } @@ -126,7 +117,6 @@ int32_t taosThreadCondWait(TdThreadCond *cond, TdThreadMutex *mutex) { } return 0; #else - THREAD_PTR_CHECK(mutex) return pthread_cond_wait(cond, mutex); #endif } @@ -140,7 +130,6 @@ int32_t taosThreadCondTimedWait(TdThreadCond *cond, TdThreadMutex *mutex, const } return EINVAL; #else - THREAD_PTR_CHECK(mutex) return pthread_cond_timedwait(cond, mutex, abstime); #endif } @@ -201,7 +190,6 @@ int32_t taosThreadKeyDelete(TdThreadKey key) { return pthread_key_delete(key); } int32_t taosThreadKill(TdThread thread, int32_t sig) { return pthread_kill(thread, sig); } // int32_t taosThreadMutexConsistent(TdThreadMutex* mutex) { -// THREAD_PTR_CHECK(mutex) // return pthread_mutex_consistent(mutex); // } @@ -210,7 +198,6 @@ int32_t taosThreadMutexDestroy(TdThreadMutex *mutex) { DeleteCriticalSection(mutex); return 0; #else - THREAD_PTR_CHECK(mutex) return pthread_mutex_destroy(mutex); #endif } @@ -234,7 +221,6 @@ int32_t taosThreadMutexLock(TdThreadMutex *mutex) { EnterCriticalSection(mutex); return 0; #else - THREAD_PTR_CHECK(mutex) return pthread_mutex_lock(mutex); #endif } @@ -248,7 +234,6 @@ int32_t taosThreadMutexTryLock(TdThreadMutex *mutex) { if (TryEnterCriticalSection(mutex)) return 0; return EBUSY; #else - THREAD_PTR_CHECK(mutex) return pthread_mutex_trylock(mutex); #endif } @@ -258,7 +243,6 @@ int32_t taosThreadMutexUnlock(TdThreadMutex *mutex) { LeaveCriticalSection(mutex); return 0; #else - THREAD_PTR_CHECK(mutex) return pthread_mutex_unlock(mutex); #endif } @@ -451,7 +435,6 @@ int32_t taosThreadSetSchedParam(TdThread thread, int32_t policy, const struct sc int32_t taosThreadSetSpecific(TdThreadKey key, const void *value) { return pthread_setspecific(key, value); } int32_t taosThreadSpinDestroy(TdThreadSpinlock *lock) { - THREAD_PTR_CHECK(lock) #ifdef TD_USE_SPINLOCK_AS_MUTEX return pthread_mutex_destroy((pthread_mutex_t *)lock); #else @@ -470,7 +453,6 @@ int32_t taosThreadSpinInit(TdThreadSpinlock *lock, int32_t pshared) { } int32_t taosThreadSpinLock(TdThreadSpinlock *lock) { - THREAD_PTR_CHECK(lock) #ifdef TD_USE_SPINLOCK_AS_MUTEX return pthread_mutex_lock((pthread_mutex_t *)lock); #else @@ -479,7 +461,6 @@ int32_t taosThreadSpinLock(TdThreadSpinlock *lock) { } int32_t taosThreadSpinTrylock(TdThreadSpinlock *lock) { - THREAD_PTR_CHECK(lock) #ifdef TD_USE_SPINLOCK_AS_MUTEX return pthread_mutex_trylock((pthread_mutex_t *)lock); #else @@ -488,7 +469,6 @@ int32_t taosThreadSpinTrylock(TdThreadSpinlock *lock) { } int32_t taosThreadSpinUnlock(TdThreadSpinlock *lock) { - THREAD_PTR_CHECK(lock) #ifdef TD_USE_SPINLOCK_AS_MUTEX return pthread_mutex_unlock((pthread_mutex_t *)lock); #else