enh: remove obsolete code

This commit is contained in:
kailixu 2024-03-28 08:19:58 +08:00
parent c54978e8e4
commit 01e5eaea12
1 changed files with 0 additions and 20 deletions

View File

@ -17,15 +17,6 @@
#include <pthread.h>
#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