modify function

This commit is contained in:
yihaoDeng 2020-07-18 03:03:04 +00:00
parent 54ab10737a
commit 7aa062c9ad
1 changed files with 2 additions and 2 deletions

View File

@ -75,7 +75,7 @@ void taosRUnLockLatch(SRWLatch *pLatch);
// copy on read
#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 (i_ % 1000 == 0) { \
sched_yield(); \
@ -84,7 +84,7 @@ void taosRUnLockLatch(SRWLatch *pLatch);
}
#define taosCorEndRead(x) \
if (atomic_load_32(x) == old_) { \
if (atomic_add_fetch_32((x), 0) == old_) { \
break; \
} \
}