refactor: set attribute only on Linux
This commit is contained in:
parent
e5087f6e23
commit
60977d56bd
|
@ -376,12 +376,16 @@ SStreamMeta* streamMetaOpen(const char* path, void* ahandle, FTaskExpand expandF
|
||||||
|
|
||||||
pMeta->rid = taosAddRef(streamMetaId, pMeta);
|
pMeta->rid = taosAddRef(streamMetaId, pMeta);
|
||||||
|
|
||||||
|
// set the attribute when running on Linux OS
|
||||||
|
#if defined LINUX
|
||||||
TdThreadRwlockAttr attr;
|
TdThreadRwlockAttr attr;
|
||||||
taosThreadRwlockAttrInit(&attr);
|
taosThreadRwlockAttrInit(&attr);
|
||||||
|
|
||||||
pthread_rwlockattr_setkind_np(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
|
pthread_rwlockattr_setkind_np(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
|
||||||
taosThreadRwlockInit(&pMeta->lock, &attr);
|
taosThreadRwlockInit(&pMeta->lock, &attr);
|
||||||
|
|
||||||
taosThreadRwlockAttrDestroy(&attr);
|
taosThreadRwlockAttrDestroy(&attr);
|
||||||
|
#endif
|
||||||
|
|
||||||
int64_t* pRid = taosMemoryMalloc(sizeof(int64_t));
|
int64_t* pRid = taosMemoryMalloc(sizeof(int64_t));
|
||||||
memcpy(pRid, &pMeta->rid, sizeof(pMeta->rid));
|
memcpy(pRid, &pMeta->rid, sizeof(pMeta->rid));
|
||||||
|
|
Loading…
Reference in New Issue