提交 7aa062c9 编写于 作者: dengyihao's avatar dengyihao

modify function

上级 54ab1073
...@@ -75,7 +75,7 @@ void taosRUnLockLatch(SRWLatch *pLatch); ...@@ -75,7 +75,7 @@ void taosRUnLockLatch(SRWLatch *pLatch);
// copy on read // copy on read
#define taosCorBeginRead(x) for (uint32_t i_ = 1; 1; ++i_) { \ #define taosCorBeginRead(x) for (uint32_t i_ = 1; 1; ++i_) { \
int32_t old_ = atomic_load_32(x); \ int32_t old_ = atomic_add_fetch_32((x), 0); \
if (old_ & 0x00000001) { \ if (old_ & 0x00000001) { \
if (i_ % 1000 == 0) { \ if (i_ % 1000 == 0) { \
sched_yield(); \ sched_yield(); \
...@@ -84,7 +84,7 @@ void taosRUnLockLatch(SRWLatch *pLatch); ...@@ -84,7 +84,7 @@ void taosRUnLockLatch(SRWLatch *pLatch);
} }
#define taosCorEndRead(x) \ #define taosCorEndRead(x) \
if (atomic_load_32(x) == old_) { \ if (atomic_add_fetch_32((x), 0) == old_) { \
break; \ break; \
} \ } \
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册