Merge pull request #24625 from taosdata/feat/TS-4478-3.0
Feat/TS-4478-3.0
This commit is contained in:
commit
5e8bd75920
|
@ -69,6 +69,19 @@ typedef pthread_key_t TdThreadKey;
|
||||||
|
|
||||||
#define taosThreadCleanupPush pthread_cleanup_push
|
#define taosThreadCleanupPush pthread_cleanup_push
|
||||||
#define taosThreadCleanupPop pthread_cleanup_pop
|
#define taosThreadCleanupPop pthread_cleanup_pop
|
||||||
|
#if !defined(WINDOWS)
|
||||||
|
#if defined(_TD_DARWIN_64) // MACOS
|
||||||
|
#define taosThreadRwlockAttrSetKindNP(A, B) ((void)0)
|
||||||
|
#else // LINUX
|
||||||
|
#if _XOPEN_SOURCE >= 500 || _POSIX_C_SOURCE >= 200809L
|
||||||
|
#define taosThreadRwlockAttrSetKindNP(A, B) pthread_rwlockattr_setkind_np(A, B)
|
||||||
|
#else
|
||||||
|
#define taosThreadRwlockAttrSetKindNP(A, B) ((void)0)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#else // WINDOWS
|
||||||
|
#define taosThreadRwlockAttrSetKindNP(A, B) ((void)0)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(WINDOWS) && !defined(__USE_PTHREAD)
|
#if defined(WINDOWS) && !defined(__USE_PTHREAD)
|
||||||
#define TD_PTHREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER_FORBID
|
#define TD_PTHREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER_FORBID
|
||||||
|
|
|
@ -27,7 +27,14 @@ static int taskIdxKeyCmpr(const void *pKey1, int kLen1, const void *pKey2, int k
|
||||||
static int btimeIdxCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen2);
|
static int btimeIdxCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen2);
|
||||||
static int ncolIdxCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen2);
|
static int ncolIdxCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen2);
|
||||||
|
|
||||||
static int32_t metaInitLock(SMeta *pMeta) { return taosThreadRwlockInit(&pMeta->lock, NULL); }
|
static int32_t metaInitLock(SMeta *pMeta) {
|
||||||
|
TdThreadRwlockAttr attr;
|
||||||
|
taosThreadRwlockAttrInit(&attr);
|
||||||
|
taosThreadRwlockAttrSetKindNP(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
|
||||||
|
taosThreadRwlockInit(&pMeta->lock, &attr);
|
||||||
|
taosThreadRwlockAttrDestroy(&attr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
static int32_t metaDestroyLock(SMeta *pMeta) { return taosThreadRwlockDestroy(&pMeta->lock); }
|
static int32_t metaDestroyLock(SMeta *pMeta) { return taosThreadRwlockDestroy(&pMeta->lock); }
|
||||||
|
|
||||||
static void metaCleanup(SMeta **ppMeta);
|
static void metaCleanup(SMeta **ppMeta);
|
||||||
|
|
Loading…
Reference in New Issue