fix index bug
This commit is contained in:
parent
570b36cb9b
commit
5a4b51a968
|
@ -127,7 +127,7 @@ int indexSearch(SIndex* index, SIndexMultiTermQuery* query, SArray* result);
|
||||||
* @parma opt (input, rebuild index opts)
|
* @parma opt (input, rebuild index opts)
|
||||||
* @return error code
|
* @return error code
|
||||||
*/
|
*/
|
||||||
int indexRebuild(SIndex* index, SIndexOpts* opt);
|
// int indexRebuild(SIndex* index, SIndexOpts* opt);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* open index
|
* open index
|
||||||
|
@ -185,6 +185,25 @@ SIndexTerm* indexTermCreate(int64_t suid, SIndexOperOnColumn operType, uint8_t c
|
||||||
int32_t nColName, const char* colVal, int32_t nColVal);
|
int32_t nColName, const char* colVal, int32_t nColVal);
|
||||||
void indexTermDestroy(SIndexTerm* p);
|
void indexTermDestroy(SIndexTerm* p);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* rebuild index
|
||||||
|
*/
|
||||||
|
void indexRebuild(SIndexJson* idx, void* iter);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* check index json status
|
||||||
|
**/
|
||||||
|
bool indexIsRebuild(SIndex* idx);
|
||||||
|
/*
|
||||||
|
* rebuild index json
|
||||||
|
*/
|
||||||
|
void indexJsonRebuild(SIndexJson* idx, void* iter);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* check index json status
|
||||||
|
**/
|
||||||
|
bool indexJsonIsRebuild(SIndexJson* idx);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* init index env
|
* init index env
|
||||||
*
|
*
|
||||||
|
@ -203,7 +222,7 @@ typedef enum { SFLT_NOT_INDEX, SFLT_COARSE_INDEX, SFLT_ACCURATE_INDEX } SIdxFltS
|
||||||
|
|
||||||
SIdxFltStatus idxGetFltStatus(SNode* pFilterNode);
|
SIdxFltStatus idxGetFltStatus(SNode* pFilterNode);
|
||||||
|
|
||||||
int32_t doFilterTag(const SNode* pFilterNode, SIndexMetaArg* metaArg, SArray* result);
|
int32_t doFilterTag(SNode* pFilterNode, SIndexMetaArg* metaArg, SArray* result, SIdxFltStatus* status);
|
||||||
/*
|
/*
|
||||||
* destory index env
|
* destory index env
|
||||||
*
|
*
|
||||||
|
|
|
@ -374,22 +374,22 @@ int metaDropTable(SMeta *pMeta, int64_t version, SVDropTbReq *pReq, SArray *tbUi
|
||||||
int metaTtlDropTable(SMeta *pMeta, int64_t ttl, SArray *tbUids) {
|
int metaTtlDropTable(SMeta *pMeta, int64_t ttl, SArray *tbUids) {
|
||||||
metaWLock(pMeta);
|
metaWLock(pMeta);
|
||||||
int ret = metaTtlSmaller(pMeta, ttl, tbUids);
|
int ret = metaTtlSmaller(pMeta, ttl, tbUids);
|
||||||
if(ret != 0){
|
if (ret != 0) {
|
||||||
metaULock(pMeta);
|
metaULock(pMeta);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < taosArrayGetSize(tbUids); ++i) {
|
for (int i = 0; i < taosArrayGetSize(tbUids); ++i) {
|
||||||
tb_uid_t *uid = (tb_uid_t *)taosArrayGet(tbUids, i);
|
tb_uid_t *uid = (tb_uid_t *)taosArrayGet(tbUids, i);
|
||||||
metaDropTableByUid(pMeta, *uid, NULL);
|
metaDropTableByUid(pMeta, *uid, NULL);
|
||||||
metaDebug("ttl drop table:%"PRId64, *uid);
|
metaDebug("ttl drop table:%" PRId64, *uid);
|
||||||
}
|
}
|
||||||
metaULock(pMeta);
|
metaULock(pMeta);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void metaBuildTtlIdxKey(STtlIdxKey *ttlKey, const SMetaEntry *pME){
|
static void metaBuildTtlIdxKey(STtlIdxKey *ttlKey, const SMetaEntry *pME) {
|
||||||
int64_t ttlDays;
|
int64_t ttlDays;
|
||||||
int64_t ctime;
|
int64_t ctime;
|
||||||
if (pME->type == TSDB_CHILD_TABLE) {
|
if (pME->type == TSDB_CHILD_TABLE) {
|
||||||
ctime = pME->ctbEntry.ctime;
|
ctime = pME->ctbEntry.ctime;
|
||||||
ttlDays = pME->ctbEntry.ttlDays;
|
ttlDays = pME->ctbEntry.ttlDays;
|
||||||
|
@ -409,11 +409,10 @@ static void metaBuildTtlIdxKey(STtlIdxKey *ttlKey, const SMetaEntry *pME){
|
||||||
static int metaDeleteTtlIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
static int metaDeleteTtlIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
||||||
STtlIdxKey ttlKey = {0};
|
STtlIdxKey ttlKey = {0};
|
||||||
metaBuildTtlIdxKey(&ttlKey, pME);
|
metaBuildTtlIdxKey(&ttlKey, pME);
|
||||||
if(ttlKey.dtime == 0) return 0;
|
if (ttlKey.dtime == 0) return 0;
|
||||||
return tdbTbDelete(pMeta->pTtlIdx, &ttlKey, sizeof(ttlKey), &pMeta->txn);
|
return tdbTbDelete(pMeta->pTtlIdx, &ttlKey, sizeof(ttlKey), &pMeta->txn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type) {
|
static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type) {
|
||||||
void * pData = NULL;
|
void * pData = NULL;
|
||||||
int nData = 0;
|
int nData = 0;
|
||||||
|
@ -434,7 +433,7 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type) {
|
||||||
tdbTbDelete(pMeta->pTbDb, &(STbDbKey){.version = version, .uid = uid}, sizeof(STbDbKey), &pMeta->txn);
|
tdbTbDelete(pMeta->pTbDb, &(STbDbKey){.version = version, .uid = uid}, sizeof(STbDbKey), &pMeta->txn);
|
||||||
tdbTbDelete(pMeta->pNameIdx, e.name, strlen(e.name) + 1, &pMeta->txn);
|
tdbTbDelete(pMeta->pNameIdx, e.name, strlen(e.name) + 1, &pMeta->txn);
|
||||||
tdbTbDelete(pMeta->pUidIdx, &uid, sizeof(uid), &pMeta->txn);
|
tdbTbDelete(pMeta->pUidIdx, &uid, sizeof(uid), &pMeta->txn);
|
||||||
if(e.type != TSDB_SUPER_TABLE) metaDeleteTtlIdx(pMeta, &e);
|
if (e.type != TSDB_SUPER_TABLE) metaDeleteTtlIdx(pMeta, &e);
|
||||||
|
|
||||||
if (e.type == TSDB_CHILD_TABLE) {
|
if (e.type == TSDB_CHILD_TABLE) {
|
||||||
tdbTbDelete(pMeta->pCtbIdx, &(SCtbIdxKey){.suid = e.ctbEntry.suid, .uid = uid}, sizeof(SCtbIdxKey), &pMeta->txn);
|
tdbTbDelete(pMeta->pCtbIdx, &(SCtbIdxKey){.suid = e.ctbEntry.suid, .uid = uid}, sizeof(SCtbIdxKey), &pMeta->txn);
|
||||||
|
@ -757,15 +756,15 @@ _err:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterTbReq) {
|
static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterTbReq) {
|
||||||
void * pVal = NULL;
|
void * pVal = NULL;
|
||||||
int nVal = 0;
|
int nVal = 0;
|
||||||
const void * pData = NULL;
|
const void *pData = NULL;
|
||||||
int nData = 0;
|
int nData = 0;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
tb_uid_t uid;
|
tb_uid_t uid;
|
||||||
int64_t oversion;
|
int64_t oversion;
|
||||||
SMetaEntry entry = {0};
|
SMetaEntry entry = {0};
|
||||||
int c = 0;
|
int c = 0;
|
||||||
|
|
||||||
// search name index
|
// search name index
|
||||||
ret = tdbTbGet(pMeta->pNameIdx, pAlterTbReq->tbName, strlen(pAlterTbReq->tbName) + 1, &pVal, &nVal);
|
ret = tdbTbGet(pMeta->pNameIdx, pAlterTbReq->tbName, strlen(pAlterTbReq->tbName) + 1, &pVal, &nVal);
|
||||||
|
@ -808,22 +807,22 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p
|
||||||
metaWLock(pMeta);
|
metaWLock(pMeta);
|
||||||
// build SMetaEntry
|
// build SMetaEntry
|
||||||
if (entry.type == TSDB_CHILD_TABLE) {
|
if (entry.type == TSDB_CHILD_TABLE) {
|
||||||
if(pAlterTbReq->updateTTL) {
|
if (pAlterTbReq->updateTTL) {
|
||||||
metaDeleteTtlIdx(pMeta, &entry);
|
metaDeleteTtlIdx(pMeta, &entry);
|
||||||
entry.ctbEntry.ttlDays = pAlterTbReq->newTTL;
|
entry.ctbEntry.ttlDays = pAlterTbReq->newTTL;
|
||||||
metaUpdateTtlIdx(pMeta, &entry);
|
metaUpdateTtlIdx(pMeta, &entry);
|
||||||
}
|
}
|
||||||
if(pAlterTbReq->newCommentLen >= 0) {
|
if (pAlterTbReq->newCommentLen >= 0) {
|
||||||
entry.ctbEntry.commentLen = pAlterTbReq->newCommentLen;
|
entry.ctbEntry.commentLen = pAlterTbReq->newCommentLen;
|
||||||
entry.ctbEntry.comment = pAlterTbReq->newComment;
|
entry.ctbEntry.comment = pAlterTbReq->newComment;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(pAlterTbReq->updateTTL) {
|
if (pAlterTbReq->updateTTL) {
|
||||||
metaDeleteTtlIdx(pMeta, &entry);
|
metaDeleteTtlIdx(pMeta, &entry);
|
||||||
entry.ntbEntry.ttlDays = pAlterTbReq->newTTL;
|
entry.ntbEntry.ttlDays = pAlterTbReq->newTTL;
|
||||||
metaUpdateTtlIdx(pMeta, &entry);
|
metaUpdateTtlIdx(pMeta, &entry);
|
||||||
}
|
}
|
||||||
if(pAlterTbReq->newCommentLen >= 0) {
|
if (pAlterTbReq->newCommentLen >= 0) {
|
||||||
entry.ntbEntry.commentLen = pAlterTbReq->newCommentLen;
|
entry.ntbEntry.commentLen = pAlterTbReq->newCommentLen;
|
||||||
entry.ntbEntry.comment = pAlterTbReq->newComment;
|
entry.ntbEntry.comment = pAlterTbReq->newComment;
|
||||||
}
|
}
|
||||||
|
@ -918,7 +917,7 @@ static int metaUpdateNameIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
||||||
static int metaUpdateTtlIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
static int metaUpdateTtlIdx(SMeta *pMeta, const SMetaEntry *pME) {
|
||||||
STtlIdxKey ttlKey = {0};
|
STtlIdxKey ttlKey = {0};
|
||||||
metaBuildTtlIdxKey(&ttlKey, pME);
|
metaBuildTtlIdxKey(&ttlKey, pME);
|
||||||
if(ttlKey.dtime == 0) return 0;
|
if (ttlKey.dtime == 0) return 0;
|
||||||
return tdbTbInsert(pMeta->pTtlIdx, &ttlKey, sizeof(ttlKey), NULL, 0, &pMeta->txn);
|
return tdbTbInsert(pMeta->pTtlIdx, &ttlKey, sizeof(ttlKey), NULL, 0, &pMeta->txn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -976,7 +975,7 @@ static int metaUpdateTagIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry) {
|
||||||
SDecoder dc = {0};
|
SDecoder dc = {0};
|
||||||
|
|
||||||
// get super table
|
// get super table
|
||||||
if(tdbTbGet(pMeta->pUidIdx, &pCtbEntry->ctbEntry.suid, sizeof(tb_uid_t), &pData, &nData) != 0){
|
if (tdbTbGet(pMeta->pUidIdx, &pCtbEntry->ctbEntry.suid, sizeof(tb_uid_t), &pData, &nData) != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tbDbKey.uid = pCtbEntry->ctbEntry.suid;
|
tbDbKey.uid = pCtbEntry->ctbEntry.suid;
|
||||||
|
|
|
@ -13,10 +13,10 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "os.h"
|
|
||||||
#include "index.h"
|
|
||||||
#include "function.h"
|
#include "function.h"
|
||||||
#include "functionMgt.h"
|
#include "functionMgt.h"
|
||||||
|
#include "index.h"
|
||||||
|
#include "os.h"
|
||||||
#include "tdatablock.h"
|
#include "tdatablock.h"
|
||||||
#include "thash.h"
|
#include "thash.h"
|
||||||
#include "tmsg.h"
|
#include "tmsg.h"
|
||||||
|
@ -25,45 +25,41 @@
|
||||||
#include "executorimpl.h"
|
#include "executorimpl.h"
|
||||||
#include "tcompression.h"
|
#include "tcompression.h"
|
||||||
|
|
||||||
void initResultRowInfo(SResultRowInfo *pResultRowInfo) {
|
void initResultRowInfo(SResultRowInfo* pResultRowInfo) {
|
||||||
pResultRowInfo->size = 0;
|
pResultRowInfo->size = 0;
|
||||||
pResultRowInfo->cur.pageId = -1;
|
pResultRowInfo->cur.pageId = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cleanupResultRowInfo(SResultRowInfo *pResultRowInfo) {
|
void cleanupResultRowInfo(SResultRowInfo* pResultRowInfo) {
|
||||||
if (pResultRowInfo == NULL) {
|
if (pResultRowInfo == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int32_t i = 0; i < pResultRowInfo->size; ++i) {
|
for (int32_t i = 0; i < pResultRowInfo->size; ++i) {
|
||||||
// if (pResultRowInfo->pResult[i]) {
|
// if (pResultRowInfo->pResult[i]) {
|
||||||
// taosMemoryFreeClear(pResultRowInfo->pResult[i]->key);
|
// taosMemoryFreeClear(pResultRowInfo->pResult[i]->key);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void closeAllResultRows(SResultRowInfo *pResultRowInfo) {
|
void closeAllResultRows(SResultRowInfo* pResultRowInfo) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isResultRowClosed(SResultRow* pRow) {
|
bool isResultRowClosed(SResultRow* pRow) { return (pRow->closed == true); }
|
||||||
return (pRow->closed == true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void closeResultRow(SResultRow* pResultRow) {
|
void closeResultRow(SResultRow* pResultRow) { pResultRow->closed = true; }
|
||||||
pResultRow->closed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO refactor: use macro
|
// TODO refactor: use macro
|
||||||
SResultRowEntryInfo* getResultEntryInfo(const SResultRow* pRow, int32_t index, const int32_t* offset) {
|
SResultRowEntryInfo* getResultEntryInfo(const SResultRow* pRow, int32_t index, const int32_t* offset) {
|
||||||
assert(index >= 0 && offset != NULL);
|
assert(index >= 0 && offset != NULL);
|
||||||
return (SResultRowEntryInfo*)((char*) pRow->pEntryInfo + offset[index]);
|
return (SResultRowEntryInfo*)((char*)pRow->pEntryInfo + offset[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t getResultRowSize(SqlFunctionCtx* pCtx, int32_t numOfOutput) {
|
size_t getResultRowSize(SqlFunctionCtx* pCtx, int32_t numOfOutput) {
|
||||||
int32_t rowSize = (numOfOutput * sizeof(SResultRowEntryInfo)) + sizeof(SResultRow);
|
int32_t rowSize = (numOfOutput * sizeof(SResultRowEntryInfo)) + sizeof(SResultRow);
|
||||||
|
|
||||||
for(int32_t i = 0; i < numOfOutput; ++i) {
|
for (int32_t i = 0; i < numOfOutput; ++i) {
|
||||||
rowSize += pCtx[i].resDataInfo.interBufSize;
|
rowSize += pCtx[i].resDataInfo.interBufSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,31 +70,29 @@ void cleanupGroupResInfo(SGroupResInfo* pGroupResInfo) {
|
||||||
assert(pGroupResInfo != NULL);
|
assert(pGroupResInfo != NULL);
|
||||||
|
|
||||||
taosArrayDestroy(pGroupResInfo->pRows);
|
taosArrayDestroy(pGroupResInfo->pRows);
|
||||||
pGroupResInfo->pRows = NULL;
|
pGroupResInfo->pRows = NULL;
|
||||||
pGroupResInfo->index = 0;
|
pGroupResInfo->index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t resultrowComparAsc(const void* p1, const void* p2) {
|
static int32_t resultrowComparAsc(const void* p1, const void* p2) {
|
||||||
SResKeyPos* pp1 = *(SResKeyPos**) p1;
|
SResKeyPos* pp1 = *(SResKeyPos**)p1;
|
||||||
SResKeyPos* pp2 = *(SResKeyPos**) p2;
|
SResKeyPos* pp2 = *(SResKeyPos**)p2;
|
||||||
|
|
||||||
if (pp1->groupId == pp2->groupId) {
|
if (pp1->groupId == pp2->groupId) {
|
||||||
int64_t pts1 = *(int64_t*) pp1->key;
|
int64_t pts1 = *(int64_t*)pp1->key;
|
||||||
int64_t pts2 = *(int64_t*) pp2->key;
|
int64_t pts2 = *(int64_t*)pp2->key;
|
||||||
|
|
||||||
if (pts1 == pts2) {
|
if (pts1 == pts2) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return pts1 < pts2? -1:1;
|
return pts1 < pts2 ? -1 : 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return pp1->groupId < pp2->groupId? -1:1;
|
return pp1->groupId < pp2->groupId ? -1 : 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t resultrowComparDesc(const void* p1, const void* p2) {
|
static int32_t resultrowComparDesc(const void* p1, const void* p2) { return resultrowComparAsc(p2, p1); }
|
||||||
return resultrowComparAsc(p2, p1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void initGroupedResultInfo(SGroupResInfo* pGroupResInfo, SHashObj* pHashmap, int32_t order) {
|
void initGroupedResultInfo(SGroupResInfo* pGroupResInfo, SHashObj* pHashmap, int32_t order) {
|
||||||
if (pGroupResInfo->pRows != NULL) {
|
if (pGroupResInfo->pRows != NULL) {
|
||||||
|
@ -110,20 +104,20 @@ void initGroupedResultInfo(SGroupResInfo* pGroupResInfo, SHashObj* pHashmap, int
|
||||||
pGroupResInfo->pRows = taosArrayInit(10, POINTER_BYTES);
|
pGroupResInfo->pRows = taosArrayInit(10, POINTER_BYTES);
|
||||||
|
|
||||||
size_t keyLen = 0;
|
size_t keyLen = 0;
|
||||||
while((pData = taosHashIterate(pHashmap, pData)) != NULL) {
|
while ((pData = taosHashIterate(pHashmap, pData)) != NULL) {
|
||||||
void* key = taosHashGetKey(pData, &keyLen);
|
void* key = taosHashGetKey(pData, &keyLen);
|
||||||
|
|
||||||
SResKeyPos* p = taosMemoryMalloc(keyLen + sizeof(SResultRowPosition));
|
SResKeyPos* p = taosMemoryMalloc(keyLen + sizeof(SResultRowPosition));
|
||||||
|
|
||||||
p->groupId = *(uint64_t*) key;
|
p->groupId = *(uint64_t*)key;
|
||||||
p->pos = *(SResultRowPosition*) pData;
|
p->pos = *(SResultRowPosition*)pData;
|
||||||
memcpy(p->key, (char*)key + sizeof(uint64_t), keyLen - sizeof(uint64_t));
|
memcpy(p->key, (char*)key + sizeof(uint64_t), keyLen - sizeof(uint64_t));
|
||||||
|
|
||||||
taosArrayPush(pGroupResInfo->pRows, &p);
|
taosArrayPush(pGroupResInfo->pRows, &p);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (order == TSDB_ORDER_ASC || order == TSDB_ORDER_DESC) {
|
if (order == TSDB_ORDER_ASC || order == TSDB_ORDER_DESC) {
|
||||||
__compar_fn_t fn = (order == TSDB_ORDER_ASC)? resultrowComparAsc:resultrowComparDesc;
|
__compar_fn_t fn = (order == TSDB_ORDER_ASC) ? resultrowComparAsc : resultrowComparDesc;
|
||||||
qsort(pGroupResInfo->pRows->pData, taosArrayGetSize(pGroupResInfo->pRows), POINTER_BYTES, fn);
|
qsort(pGroupResInfo->pRows->pData, taosArrayGetSize(pGroupResInfo->pRows), POINTER_BYTES, fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +149,7 @@ int32_t getNumOfTotalRes(SGroupResInfo* pGroupResInfo) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int32_t) taosArrayGetSize(pGroupResInfo->pRows);
|
return (int32_t)taosArrayGetSize(pGroupResInfo->pRows);
|
||||||
}
|
}
|
||||||
|
|
||||||
SArray* createSortInfo(SNodeList* pNodeList) {
|
SArray* createSortInfo(SNodeList* pNodeList) {
|
||||||
|
@ -189,12 +183,13 @@ SSDataBlock* createResDataBlock(SDataBlockDescNode* pNode) {
|
||||||
pBlock->info.type = STREAM_INVALID;
|
pBlock->info.type = STREAM_INVALID;
|
||||||
|
|
||||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||||
SSlotDescNode* pDescNode = (SSlotDescNode*)nodesListGetNode(pNode->pSlots, i);
|
SSlotDescNode* pDescNode = (SSlotDescNode*)nodesListGetNode(pNode->pSlots, i);
|
||||||
// if (!pDescNode->output) { // todo disable it temporarily
|
// if (!pDescNode->output) { // todo disable it temporarily
|
||||||
// continue;
|
// continue;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
SColumnInfoData idata = createColumnInfoData(pDescNode->dataType.type, pDescNode->dataType.bytes, pDescNode->slotId);
|
SColumnInfoData idata =
|
||||||
|
createColumnInfoData(pDescNode->dataType.type, pDescNode->dataType.bytes, pDescNode->slotId);
|
||||||
idata.info.scale = pDescNode->dataType.scale;
|
idata.info.scale = pDescNode->dataType.scale;
|
||||||
idata.info.precision = pDescNode->dataType.precision;
|
idata.info.precision = pDescNode->dataType.precision;
|
||||||
|
|
||||||
|
@ -206,10 +201,10 @@ SSDataBlock* createResDataBlock(SDataBlockDescNode* pNode) {
|
||||||
|
|
||||||
EDealRes doTranslateTagExpr(SNode** pNode, void* pContext) {
|
EDealRes doTranslateTagExpr(SNode** pNode, void* pContext) {
|
||||||
SMetaReader* mr = (SMetaReader*)pContext;
|
SMetaReader* mr = (SMetaReader*)pContext;
|
||||||
if(nodeType(*pNode) == QUERY_NODE_COLUMN){
|
if (nodeType(*pNode) == QUERY_NODE_COLUMN) {
|
||||||
SColumnNode* pSColumnNode = *(SColumnNode**)pNode;
|
SColumnNode* pSColumnNode = *(SColumnNode**)pNode;
|
||||||
|
|
||||||
SValueNode *res = (SValueNode *)nodesMakeNode(QUERY_NODE_VALUE);
|
SValueNode* res = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE);
|
||||||
if (NULL == res) {
|
if (NULL == res) {
|
||||||
return DEAL_RES_ERROR;
|
return DEAL_RES_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -222,8 +217,8 @@ EDealRes doTranslateTagExpr(SNode** pNode, void* pContext) {
|
||||||
const char* p = metaGetTableTagVal(&mr->me, pSColumnNode->node.resType.type, &tagVal);
|
const char* p = metaGetTableTagVal(&mr->me, pSColumnNode->node.resType.type, &tagVal);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
res->node.resType.type = TSDB_DATA_TYPE_NULL;
|
res->node.resType.type = TSDB_DATA_TYPE_NULL;
|
||||||
}else if (pSColumnNode->node.resType.type == TSDB_DATA_TYPE_JSON) {
|
} else if (pSColumnNode->node.resType.type == TSDB_DATA_TYPE_JSON) {
|
||||||
int32_t len = ((const STag*)p) -> len;
|
int32_t len = ((const STag*)p)->len;
|
||||||
res->datum.p = taosMemoryCalloc(len + 1, 1);
|
res->datum.p = taosMemoryCalloc(len + 1, 1);
|
||||||
memcpy(res->datum.p, p, len);
|
memcpy(res->datum.p, p, len);
|
||||||
} else if (IS_VAR_DATA_TYPE(pSColumnNode->node.resType.type)) {
|
} else if (IS_VAR_DATA_TYPE(pSColumnNode->node.resType.type)) {
|
||||||
|
@ -235,10 +230,10 @@ EDealRes doTranslateTagExpr(SNode** pNode, void* pContext) {
|
||||||
}
|
}
|
||||||
nodesDestroyNode(*pNode);
|
nodesDestroyNode(*pNode);
|
||||||
*pNode = (SNode*)res;
|
*pNode = (SNode*)res;
|
||||||
}else if (nodeType(*pNode) == QUERY_NODE_FUNCTION){
|
} else if (nodeType(*pNode) == QUERY_NODE_FUNCTION) {
|
||||||
SFunctionNode * pFuncNode = *(SFunctionNode**)pNode;
|
SFunctionNode* pFuncNode = *(SFunctionNode**)pNode;
|
||||||
if(pFuncNode->funcType == FUNCTION_TYPE_TBNAME){
|
if (pFuncNode->funcType == FUNCTION_TYPE_TBNAME) {
|
||||||
SValueNode *res = (SValueNode *)nodesMakeNode(QUERY_NODE_VALUE);
|
SValueNode* res = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE);
|
||||||
if (NULL == res) {
|
if (NULL == res) {
|
||||||
return DEAL_RES_ERROR;
|
return DEAL_RES_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -258,12 +253,12 @@ EDealRes doTranslateTagExpr(SNode** pNode, void* pContext) {
|
||||||
return DEAL_RES_CONTINUE;
|
return DEAL_RES_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isTableOk(STableKeyInfo* info, SNode *pTagCond, SMeta *metaHandle){
|
static bool isTableOk(STableKeyInfo* info, SNode* pTagCond, SMeta* metaHandle) {
|
||||||
SMetaReader mr = {0};
|
SMetaReader mr = {0};
|
||||||
metaReaderInit(&mr, metaHandle, 0);
|
metaReaderInit(&mr, metaHandle, 0);
|
||||||
metaGetTableEntryByUid(&mr, info->uid);
|
metaGetTableEntryByUid(&mr, info->uid);
|
||||||
|
|
||||||
SNode *pTagCondTmp = nodesCloneNode(pTagCond);
|
SNode* pTagCondTmp = nodesCloneNode(pTagCond);
|
||||||
|
|
||||||
nodesRewriteExprPostOrder(&pTagCondTmp, doTranslateTagExpr, &mr);
|
nodesRewriteExprPostOrder(&pTagCondTmp, doTranslateTagExpr, &mr);
|
||||||
metaReaderClear(&mr);
|
metaReaderClear(&mr);
|
||||||
|
@ -276,7 +271,7 @@ static bool isTableOk(STableKeyInfo* info, SNode *pTagCond, SMeta *metaHandle){
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT(nodeType(pNew) == QUERY_NODE_VALUE);
|
ASSERT(nodeType(pNew) == QUERY_NODE_VALUE);
|
||||||
SValueNode *pValue = (SValueNode *)pNew;
|
SValueNode* pValue = (SValueNode*)pNew;
|
||||||
|
|
||||||
ASSERT(pValue->node.resType.type == TSDB_DATA_TYPE_BOOL);
|
ASSERT(pValue->node.resType.type == TSDB_DATA_TYPE_BOOL);
|
||||||
bool result = pValue->datum.b;
|
bool result = pValue->datum.b;
|
||||||
|
@ -287,12 +282,12 @@ static bool isTableOk(STableKeyInfo* info, SNode *pTagCond, SMeta *metaHandle){
|
||||||
int32_t getTableList(void* metaHandle, SScanPhysiNode* pScanNode, STableListInfo* pListInfo) {
|
int32_t getTableList(void* metaHandle, SScanPhysiNode* pScanNode, STableListInfo* pListInfo) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
pListInfo->pTableList = taosArrayInit(8, sizeof(STableKeyInfo));
|
pListInfo->pTableList = taosArrayInit(8, sizeof(STableKeyInfo));
|
||||||
if(pListInfo->pTableList == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
if (pListInfo->pTableList == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
uint64_t tableUid = pScanNode->uid;
|
uint64_t tableUid = pScanNode->uid;
|
||||||
|
|
||||||
pListInfo->suid = pScanNode->suid;
|
pListInfo->suid = pScanNode->suid;
|
||||||
|
|
||||||
SNode* pTagCond = (SNode*)pListInfo->pTagCond;
|
SNode* pTagCond = (SNode*)pListInfo->pTagCond;
|
||||||
SNode* pTagIndexCond = (SNode*)pListInfo->pTagIndexCond;
|
SNode* pTagIndexCond = (SNode*)pListInfo->pTagIndexCond;
|
||||||
if (pScanNode->tableType == TSDB_SUPER_TABLE) {
|
if (pScanNode->tableType == TSDB_SUPER_TABLE) {
|
||||||
|
@ -300,9 +295,12 @@ int32_t getTableList(void* metaHandle, SScanPhysiNode* pScanNode, STableListInfo
|
||||||
SIndexMetaArg metaArg = {
|
SIndexMetaArg metaArg = {
|
||||||
.metaEx = metaHandle, .idx = tsdbGetIdx(metaHandle), .ivtIdx = tsdbGetIvtIdx(metaHandle), .suid = tableUid};
|
.metaEx = metaHandle, .idx = tsdbGetIdx(metaHandle), .ivtIdx = tsdbGetIvtIdx(metaHandle), .suid = tableUid};
|
||||||
|
|
||||||
SArray* res = taosArrayInit(8, sizeof(uint64_t));
|
SArray* res = taosArrayInit(8, sizeof(uint64_t));
|
||||||
//code = doFilterTag(pTagIndexCond, &metaArg, res);
|
SIdxFltStatus status = SFLT_NOT_INDEX;
|
||||||
code = TSDB_CODE_INDEX_REBUILDING;
|
code = doFilterTag(pTagIndexCond, &metaArg, res, &status);
|
||||||
|
if (code != 0 || status == SFLT_NOT_INDEX) {
|
||||||
|
code = TSDB_CODE_INDEX_REBUILDING;
|
||||||
|
}
|
||||||
if (code == TSDB_CODE_INDEX_REBUILDING) {
|
if (code == TSDB_CODE_INDEX_REBUILDING) {
|
||||||
code = tsdbGetAllTableList(metaHandle, tableUid, pListInfo->pTableList);
|
code = tsdbGetAllTableList(metaHandle, tableUid, pListInfo->pTableList);
|
||||||
} else if (code != TSDB_CODE_SUCCESS) {
|
} else if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
@ -323,33 +321,33 @@ int32_t getTableList(void* metaHandle, SScanPhysiNode* pScanNode, STableListInfo
|
||||||
code = tsdbGetAllTableList(metaHandle, tableUid, pListInfo->pTableList);
|
code = tsdbGetAllTableList(metaHandle, tableUid, pListInfo->pTableList);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pTagCond){
|
if (pTagCond) {
|
||||||
int32_t i = 0;
|
int32_t i = 0;
|
||||||
while(i < taosArrayGetSize(pListInfo->pTableList)) {
|
while (i < taosArrayGetSize(pListInfo->pTableList)) {
|
||||||
STableKeyInfo* info = taosArrayGet(pListInfo->pTableList, i);
|
STableKeyInfo* info = taosArrayGet(pListInfo->pTableList, i);
|
||||||
bool isOk = isTableOk(info, pTagCond, metaHandle);
|
bool isOk = isTableOk(info, pTagCond, metaHandle);
|
||||||
if(!isOk){
|
if (!isOk) {
|
||||||
taosArrayRemove(pListInfo->pTableList, i);
|
taosArrayRemove(pListInfo->pTableList, i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else { // Create one table group.
|
} else { // Create one table group.
|
||||||
STableKeyInfo info = {.lastKey = 0, .uid = tableUid};
|
STableKeyInfo info = {.lastKey = 0, .uid = tableUid};
|
||||||
taosArrayPush(pListInfo->pTableList, &info);
|
taosArrayPush(pListInfo->pTableList, &info);
|
||||||
}
|
}
|
||||||
pListInfo->pGroupList = taosArrayInit(4, POINTER_BYTES);
|
pListInfo->pGroupList = taosArrayInit(4, POINTER_BYTES);
|
||||||
if(pListInfo->pGroupList == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
if (pListInfo->pGroupList == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
//put into list as default group, remove it if grouping sorting is required later
|
// put into list as default group, remove it if grouping sorting is required later
|
||||||
taosArrayPush(pListInfo->pGroupList, &pListInfo->pTableList);
|
taosArrayPush(pListInfo->pGroupList, &pListInfo->pTableList);
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
SArray* extractPartitionColInfo(SNodeList* pNodeList) {
|
SArray* extractPartitionColInfo(SNodeList* pNodeList) {
|
||||||
if(!pNodeList) {
|
if (!pNodeList) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,7 +376,6 @@ SArray* extractPartitionColInfo(SNodeList* pNodeList) {
|
||||||
return pList;
|
return pList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SArray* extractColMatchInfo(SNodeList* pNodeList, SDataBlockDescNode* pOutputNodeList, int32_t* numOfOutputCols,
|
SArray* extractColMatchInfo(SNodeList* pNodeList, SDataBlockDescNode* pOutputNodeList, int32_t* numOfOutputCols,
|
||||||
int32_t type) {
|
int32_t type) {
|
||||||
size_t numOfCols = LIST_LENGTH(pNodeList);
|
size_t numOfCols = LIST_LENGTH(pNodeList);
|
||||||
|
@ -394,7 +391,7 @@ SArray* extractColMatchInfo(SNodeList* pNodeList, SDataBlockDescNode* pOutputNod
|
||||||
|
|
||||||
SColMatchInfo c = {0};
|
SColMatchInfo c = {0};
|
||||||
c.output = true;
|
c.output = true;
|
||||||
c.colId = pColNode->colId;
|
c.colId = pColNode->colId;
|
||||||
c.srcSlotId = pColNode->slotId;
|
c.srcSlotId = pColNode->slotId;
|
||||||
c.matchType = type;
|
c.matchType = type;
|
||||||
c.targetSlotId = pNode->slotId;
|
c.targetSlotId = pNode->slotId;
|
||||||
|
@ -670,8 +667,8 @@ SqlFunctionCtx* createSqlFunctionCtx(SExprInfo* pExprInfo, int32_t numOfOutput,
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 1; i < numOfOutput; ++i) {
|
for (int32_t i = 1; i < numOfOutput; ++i) {
|
||||||
(*rowEntryInfoOffset)[i] =
|
(*rowEntryInfoOffset)[i] = (int32_t)((*rowEntryInfoOffset)[i - 1] + sizeof(SResultRowEntryInfo) +
|
||||||
(int32_t)((*rowEntryInfoOffset)[i - 1] + sizeof(SResultRowEntryInfo) + pFuncCtx[i - 1].resDataInfo.interBufSize);
|
pFuncCtx[i - 1].resDataInfo.interBufSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
setSelectValueColumnInfo(pFuncCtx, numOfOutput);
|
setSelectValueColumnInfo(pFuncCtx, numOfOutput);
|
||||||
|
|
|
@ -45,6 +45,7 @@ extern "C" {
|
||||||
|
|
||||||
typedef enum { LT, LE, GT, GE, CONTAINS, EQ } RangeType;
|
typedef enum { LT, LE, GT, GE, CONTAINS, EQ } RangeType;
|
||||||
typedef enum { kTypeValue, kTypeDeletion } STermValueType;
|
typedef enum { kTypeValue, kTypeDeletion } STermValueType;
|
||||||
|
typedef enum { kRebuild, kFinished } SIdxStatus;
|
||||||
|
|
||||||
typedef struct SIndexStat {
|
typedef struct SIndexStat {
|
||||||
int32_t totalAdded; //
|
int32_t totalAdded; //
|
||||||
|
@ -65,6 +66,7 @@ struct SIndex {
|
||||||
|
|
||||||
char* path;
|
char* path;
|
||||||
|
|
||||||
|
int8_t status;
|
||||||
SIndexStat stat;
|
SIndexStat stat;
|
||||||
TdThreadMutex mtx;
|
TdThreadMutex mtx;
|
||||||
tsem_t sem;
|
tsem_t sem;
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
#define INDEX_DATA_BIGINT_NULL 0x8000000000000000LL
|
#define INDEX_DATA_BIGINT_NULL 0x8000000000000000LL
|
||||||
#define INDEX_DATA_TIMESTAMP_NULL TSDB_DATA_BIGINT_NULL
|
#define INDEX_DATA_TIMESTAMP_NULL TSDB_DATA_BIGINT_NULL
|
||||||
|
|
||||||
#define INDEX_DATA_FLOAT_NULL 0x7FF00000 // it is an NAN
|
#define INDEX_DATA_FLOAT_NULL 0x7FF00000 // it is an NAN
|
||||||
#define INDEX_DATA_DOUBLE_NULL 0x7FFFFF0000000000LL // an NAN
|
#define INDEX_DATA_DOUBLE_NULL 0x7FFFFF0000000000LL // an NAN
|
||||||
#define INDEX_DATA_NCHAR_NULL 0xFFFFFFFF
|
#define INDEX_DATA_NCHAR_NULL 0xFFFFFFFF
|
||||||
#define INDEX_DATA_BINARY_NULL 0xFF
|
#define INDEX_DATA_BINARY_NULL 0xFF
|
||||||
|
@ -230,7 +230,7 @@ int indexSearch(SIndex* index, SIndexMultiTermQuery* multiQuerys, SArray* result
|
||||||
}
|
}
|
||||||
|
|
||||||
int indexDelete(SIndex* index, SIndexMultiTermQuery* query) { return 1; }
|
int indexDelete(SIndex* index, SIndexMultiTermQuery* query) { return 1; }
|
||||||
int indexRebuild(SIndex* index, SIndexOpts* opts) { return 0; }
|
// int indexRebuild(SIndex* index, SIndexOpts* opts) { return 0; }
|
||||||
|
|
||||||
SIndexOpts* indexOptsCreate() { return NULL; }
|
SIndexOpts* indexOptsCreate() { return NULL; }
|
||||||
void indexOptsDestroy(SIndexOpts* opts) { return; }
|
void indexOptsDestroy(SIndexOpts* opts) { return; }
|
||||||
|
@ -299,6 +299,7 @@ SIndexTerm* indexTermCreate(int64_t suid, SIndexOperOnColumn oper, uint8_t colTy
|
||||||
|
|
||||||
return tm;
|
return tm;
|
||||||
}
|
}
|
||||||
|
|
||||||
void indexTermDestroy(SIndexTerm* p) {
|
void indexTermDestroy(SIndexTerm* p) {
|
||||||
taosMemoryFree(p->colName);
|
taosMemoryFree(p->colName);
|
||||||
taosMemoryFree(p->colVal);
|
taosMemoryFree(p->colVal);
|
||||||
|
@ -319,6 +320,54 @@ void indexMultiTermDestroy(SIndexMultiTerm* terms) {
|
||||||
taosArrayDestroy(terms);
|
taosArrayDestroy(terms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* rebuild index
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void idxSchedRebuildIdx(SSchedMsg* msg) {
|
||||||
|
// TODO
|
||||||
|
SIndex* idx = msg->ahandle;
|
||||||
|
|
||||||
|
int8_t st = kFinished;
|
||||||
|
atomic_store_8(&idx->status, st);
|
||||||
|
idxReleaseRef(idx->refId);
|
||||||
|
}
|
||||||
|
void indexRebuild(SIndexJson* idx, void* iter) {
|
||||||
|
// set up rebuild status
|
||||||
|
int8_t st = kRebuild;
|
||||||
|
atomic_store_8(&idx->status, st);
|
||||||
|
|
||||||
|
// task put into BG thread
|
||||||
|
SSchedMsg schedMsg = {0};
|
||||||
|
schedMsg.fp = idxSchedRebuildIdx;
|
||||||
|
schedMsg.ahandle = idx;
|
||||||
|
idxAcquireRef(idx->refId);
|
||||||
|
taosScheduleTask(indexQhandle, &schedMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* check index json status
|
||||||
|
**/
|
||||||
|
bool indexIsRebuild(SIndex* idx) {
|
||||||
|
// idx rebuild or not
|
||||||
|
return ((SIdxStatus)atomic_load_8(&idx->status)) == kRebuild ? true : false;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* rebuild index
|
||||||
|
*/
|
||||||
|
void indexJsonRebuild(SIndexJson* idx, void* iter) {
|
||||||
|
// idx rebuild or not
|
||||||
|
indexRebuild(idx, iter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* check index json status
|
||||||
|
**/
|
||||||
|
bool indexJsonIsRebuild(SIndexJson* idx) {
|
||||||
|
// load idx rebuild or not
|
||||||
|
return ((SIdxStatus)atomic_load_8(&idx->status)) == kRebuild ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
static int idxTermSearch(SIndex* sIdx, SIndexTermQuery* query, SArray** result) {
|
static int idxTermSearch(SIndex* sIdx, SIndexTermQuery* query, SArray** result) {
|
||||||
SIndexTerm* term = query->term;
|
SIndexTerm* term = query->term;
|
||||||
const char* colName = term->colName;
|
const char* colName = term->colName;
|
||||||
|
|
|
@ -192,7 +192,7 @@ static int32_t sifInitParam(SNode *node, SIFParam *param, SIFCtx *ctx) {
|
||||||
switch (nodeType(node)) {
|
switch (nodeType(node)) {
|
||||||
case QUERY_NODE_VALUE: {
|
case QUERY_NODE_VALUE: {
|
||||||
SValueNode *vn = (SValueNode *)node;
|
SValueNode *vn = (SValueNode *)node;
|
||||||
if (vn->typeData == TSDB_DATA_TYPE_NULL && (vn->literal == NULL || strlen(vn->literal) == 0)) {
|
if (vn->typeData == TSDB_DATA_TYPE_NULL || (vn->literal == NULL || strlen(vn->literal) == 0)) {
|
||||||
param->status = SFLT_NOT_INDEX;
|
param->status = SFLT_NOT_INDEX;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -737,21 +737,20 @@ static int32_t sifGetFltHint(SNode *pNode, SIdxFltStatus *status) {
|
||||||
SIF_RET(code);
|
SIF_RET(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t doFilterTag(const SNode *pFilterNode, SIndexMetaArg *metaArg, SArray *result) {
|
int32_t doFilterTag(SNode *pFilterNode, SIndexMetaArg *metaArg, SArray *result, SIdxFltStatus *status) {
|
||||||
if (pFilterNode == NULL) {
|
SIdxFltStatus st = idxGetFltStatus(pFilterNode);
|
||||||
return TSDB_CODE_SUCCESS;
|
if (st == SFLT_NOT_INDEX) {
|
||||||
|
*status = st;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SFilterInfo *filter = NULL;
|
SFilterInfo *filter = NULL;
|
||||||
// todo move to the initialization function
|
|
||||||
// SIF_ERR_RET(filterInitFromNode((SNode *)pFilterNode, &filter, 0));
|
|
||||||
|
|
||||||
SArray * output = taosArrayInit(8, sizeof(uint64_t));
|
SArray * output = taosArrayInit(8, sizeof(uint64_t));
|
||||||
SIFParam param = {.arg = *metaArg, .result = output};
|
SIFParam param = {.arg = *metaArg, .result = output};
|
||||||
SIF_ERR_RET(sifCalculate((SNode *)pFilterNode, ¶m));
|
SIF_ERR_RET(sifCalculate((SNode *)pFilterNode, ¶m));
|
||||||
|
|
||||||
taosArrayAddAll(result, param.result);
|
taosArrayAddAll(result, param.result);
|
||||||
// taosArrayAddAll(result, param.result);
|
|
||||||
sifFreeParam(¶m);
|
sifFreeParam(¶m);
|
||||||
SIF_RET(TSDB_CODE_SUCCESS);
|
SIF_RET(TSDB_CODE_SUCCESS);
|
||||||
}
|
}
|
||||||
|
@ -761,9 +760,6 @@ SIdxFltStatus idxGetFltStatus(SNode *pFilterNode) {
|
||||||
if (pFilterNode == NULL) {
|
if (pFilterNode == NULL) {
|
||||||
return SFLT_NOT_INDEX;
|
return SFLT_NOT_INDEX;
|
||||||
}
|
}
|
||||||
// SFilterInfo *filter = NULL;
|
|
||||||
// todo move to the initialization function
|
|
||||||
// SIF_ERR_RET(filterInitFromNode((SNode *)pFilterNode, &filter, 0));
|
|
||||||
|
|
||||||
SIF_ERR_RET(sifGetFltHint((SNode *)pFilterNode, &st));
|
SIF_ERR_RET(sifGetFltHint((SNode *)pFilterNode, &st));
|
||||||
return st;
|
return st;
|
||||||
|
|
|
@ -19,23 +19,19 @@
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
|
|
||||||
// add
|
// add
|
||||||
int8_t interlocked_add_fetch_8(int8_t volatile* ptr, int8_t val) {
|
int8_t interlocked_add_fetch_8(int8_t volatile* ptr, int8_t val) { return _InterlockedExchangeAdd8(ptr, val) + val; }
|
||||||
return _InterlockedExchangeAdd8(ptr, val) + val;
|
|
||||||
}
|
|
||||||
|
|
||||||
int16_t interlocked_add_fetch_16(int16_t volatile* ptr, int16_t val) {
|
int16_t interlocked_add_fetch_16(int16_t volatile* ptr, int16_t val) {
|
||||||
return _InterlockedExchangeAdd16(ptr, val) + val;
|
return _InterlockedExchangeAdd16(ptr, val) + val;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t interlocked_add_fetch_32(int32_t volatile* ptr, int32_t val) {
|
int32_t interlocked_add_fetch_32(int32_t volatile* ptr, int32_t val) { return _InterlockedExchangeAdd(ptr, val) + val; }
|
||||||
return _InterlockedExchangeAdd(ptr, val) + val;
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t interlocked_add_fetch_64(int64_t volatile* ptr, int64_t val) {
|
int64_t interlocked_add_fetch_64(int64_t volatile* ptr, int64_t val) {
|
||||||
return InterlockedExchangeAdd64(ptr, val) + val;
|
return InterlockedExchangeAdd64(ptr, val) + val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* interlocked_add_fetch_ptr(void* volatile* ptr, void* val) {
|
void* interlocked_add_fetch_ptr(void* volatile* ptr, void* val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return (void*)(_InterlockedExchangeAdd((int32_t volatile*)(ptr), (int32_t)val) + (int32_t)val);
|
return (void*)(_InterlockedExchangeAdd((int32_t volatile*)(ptr), (int32_t)val) + (int32_t)val);
|
||||||
#else
|
#else
|
||||||
|
@ -43,17 +39,11 @@ void* interlocked_add_fetch_ptr(void* volatile* ptr, void* val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t interlocked_and_fetch_8(int8_t volatile* ptr, int8_t val) {
|
int8_t interlocked_and_fetch_8(int8_t volatile* ptr, int8_t val) { return _InterlockedAnd8(ptr, val) & val; }
|
||||||
return _InterlockedAnd8(ptr, val) & val;
|
|
||||||
}
|
|
||||||
|
|
||||||
int16_t interlocked_and_fetch_16(int16_t volatile* ptr, int16_t val) {
|
int16_t interlocked_and_fetch_16(int16_t volatile* ptr, int16_t val) { return _InterlockedAnd16(ptr, val) & val; }
|
||||||
return _InterlockedAnd16(ptr, val) & val;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t interlocked_and_fetch_32(int32_t volatile* ptr, int32_t val) {
|
int32_t interlocked_and_fetch_32(int32_t volatile* ptr, int32_t val) { return _InterlockedAnd(ptr, val) & val; }
|
||||||
return _InterlockedAnd(ptr, val) & val;
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t interlocked_and_fetch_64(int64_t volatile* ptr, int64_t val) {
|
int64_t interlocked_and_fetch_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
|
@ -96,17 +86,11 @@ void* interlocked_fetch_and_ptr(void* volatile* ptr, void* val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t interlocked_or_fetch_8(int8_t volatile* ptr, int8_t val) {
|
int8_t interlocked_or_fetch_8(int8_t volatile* ptr, int8_t val) { return _InterlockedOr8(ptr, val) | val; }
|
||||||
return _InterlockedOr8(ptr, val) | val;
|
|
||||||
}
|
|
||||||
|
|
||||||
int16_t interlocked_or_fetch_16(int16_t volatile* ptr, int16_t val) {
|
int16_t interlocked_or_fetch_16(int16_t volatile* ptr, int16_t val) { return _InterlockedOr16(ptr, val) | val; }
|
||||||
return _InterlockedOr16(ptr, val) | val;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t interlocked_or_fetch_32(int32_t volatile* ptr, int32_t val) {
|
int32_t interlocked_or_fetch_32(int32_t volatile* ptr, int32_t val) { return _InterlockedOr(ptr, val) | val; }
|
||||||
return _InterlockedOr(ptr, val) | val;
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t interlocked_or_fetch_64(int64_t volatile* ptr, int64_t val) {
|
int64_t interlocked_or_fetch_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
|
@ -114,7 +98,7 @@ int64_t interlocked_or_fetch_64(int64_t volatile* ptr, int64_t val) {
|
||||||
do {
|
do {
|
||||||
old = *ptr;
|
old = *ptr;
|
||||||
res = old | val;
|
res = old | val;
|
||||||
} while(_InterlockedCompareExchange64(ptr, res, old) != old);
|
} while (_InterlockedCompareExchange64(ptr, res, old) != old);
|
||||||
return res;
|
return res;
|
||||||
#else
|
#else
|
||||||
return _InterlockedOr64(ptr, val) & val;
|
return _InterlockedOr64(ptr, val) & val;
|
||||||
|
@ -134,7 +118,7 @@ int64_t interlocked_fetch_or_64(int64_t volatile* ptr, int64_t val) {
|
||||||
int64_t old;
|
int64_t old;
|
||||||
do {
|
do {
|
||||||
old = *ptr;
|
old = *ptr;
|
||||||
} while(_InterlockedCompareExchange64(ptr, old | val, old) != old);
|
} while (_InterlockedCompareExchange64(ptr, old | val, old) != old);
|
||||||
return old;
|
return old;
|
||||||
#else
|
#else
|
||||||
return _InterlockedOr64((int64_t volatile*)(ptr), (int64_t)(val));
|
return _InterlockedOr64((int64_t volatile*)(ptr), (int64_t)(val));
|
||||||
|
@ -149,17 +133,11 @@ void* interlocked_fetch_or_ptr(void* volatile* ptr, void* val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t interlocked_xor_fetch_8(int8_t volatile* ptr, int8_t val) {
|
int8_t interlocked_xor_fetch_8(int8_t volatile* ptr, int8_t val) { return _InterlockedXor8(ptr, val) ^ val; }
|
||||||
return _InterlockedXor8(ptr, val) ^ val;
|
|
||||||
}
|
|
||||||
|
|
||||||
int16_t interlocked_xor_fetch_16(int16_t volatile* ptr, int16_t val) {
|
int16_t interlocked_xor_fetch_16(int16_t volatile* ptr, int16_t val) { return _InterlockedXor16(ptr, val) ^ val; }
|
||||||
return _InterlockedXor16(ptr, val) ^ val;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t interlocked_xor_fetch_32(int32_t volatile* ptr, int32_t val) {
|
int32_t interlocked_xor_fetch_32(int32_t volatile* ptr, int32_t val) { return _InterlockedXor(ptr, val) ^ val; }
|
||||||
return _InterlockedXor(ptr, val) ^ val;
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t interlocked_xor_fetch_64(int64_t volatile* ptr, int64_t val) {
|
int64_t interlocked_xor_fetch_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
|
@ -167,7 +145,7 @@ int64_t interlocked_xor_fetch_64(int64_t volatile* ptr, int64_t val) {
|
||||||
do {
|
do {
|
||||||
old = *ptr;
|
old = *ptr;
|
||||||
res = old ^ val;
|
res = old ^ val;
|
||||||
} while(_InterlockedCompareExchange64(ptr, res, old) != old);
|
} while (_InterlockedCompareExchange64(ptr, res, old) != old);
|
||||||
return res;
|
return res;
|
||||||
#else
|
#else
|
||||||
return _InterlockedXor64(ptr, val) ^ val;
|
return _InterlockedXor64(ptr, val) ^ val;
|
||||||
|
@ -202,13 +180,9 @@ void* interlocked_fetch_xor_ptr(void* volatile* ptr, void* val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t interlocked_sub_fetch_32(int32_t volatile* ptr, int32_t val) {
|
int32_t interlocked_sub_fetch_32(int32_t volatile* ptr, int32_t val) { return interlocked_add_fetch_32(ptr, -val); }
|
||||||
return interlocked_add_fetch_32(ptr, -val);
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t interlocked_sub_fetch_64(int64_t volatile* ptr, int64_t val) {
|
int64_t interlocked_sub_fetch_64(int64_t volatile* ptr, int64_t val) { return interlocked_add_fetch_64(ptr, -val); }
|
||||||
return interlocked_add_fetch_64(ptr, -val);
|
|
||||||
}
|
|
||||||
|
|
||||||
void* interlocked_sub_fetch_ptr(void* volatile* ptr, void* val) {
|
void* interlocked_sub_fetch_ptr(void* volatile* ptr, void* val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
|
@ -217,13 +191,9 @@ void* interlocked_sub_fetch_ptr(void* volatile* ptr, void* val) {
|
||||||
return (void*)interlocked_add_fetch_64((int64_t volatile*)ptr, (int64_t)val);
|
return (void*)interlocked_add_fetch_64((int64_t volatile*)ptr, (int64_t)val);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
int32_t interlocked_fetch_sub_32(int32_t volatile* ptr, int32_t val) {
|
int32_t interlocked_fetch_sub_32(int32_t volatile* ptr, int32_t val) { return _InterlockedExchangeAdd(ptr, -val); }
|
||||||
return _InterlockedExchangeAdd(ptr, -val);
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t interlocked_fetch_sub_64(int64_t volatile* ptr, int64_t val) {
|
int64_t interlocked_fetch_sub_64(int64_t volatile* ptr, int64_t val) { return _InterlockedExchangeAdd64(ptr, -val); }
|
||||||
return _InterlockedExchangeAdd64(ptr, -val);
|
|
||||||
}
|
|
||||||
|
|
||||||
void* interlocked_fetch_sub_ptr(void* volatile* ptr, void* val) {
|
void* interlocked_fetch_sub_ptr(void* volatile* ptr, void* val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
|
@ -236,45 +206,44 @@ void* interlocked_fetch_sub_ptr(void* volatile* ptr, void* val) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _TD_NINGSI_60
|
#ifdef _TD_NINGSI_60
|
||||||
void* atomic_exchange_ptr_impl(void** ptr, void* val ) {
|
void* atomic_exchange_ptr_impl(void** ptr, void* val) {
|
||||||
void *old;
|
void* old;
|
||||||
do {
|
do {
|
||||||
old = *ptr;
|
old = *ptr;
|
||||||
} while( !__sync_bool_compare_and_swap(ptr, old, val) );
|
} while (!__sync_bool_compare_and_swap(ptr, old, val));
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
int8_t atomic_exchange_8_impl(int8_t* ptr, int8_t val ) {
|
int8_t atomic_exchange_8_impl(int8_t* ptr, int8_t val) {
|
||||||
int8_t old;
|
int8_t old;
|
||||||
do {
|
do {
|
||||||
old = *ptr;
|
old = *ptr;
|
||||||
} while( !__sync_bool_compare_and_swap(ptr, old, val) );
|
} while (!__sync_bool_compare_and_swap(ptr, old, val));
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
int16_t atomic_exchange_16_impl(int16_t* ptr, int16_t val ) {
|
int16_t atomic_exchange_16_impl(int16_t* ptr, int16_t val) {
|
||||||
int16_t old;
|
int16_t old;
|
||||||
do {
|
do {
|
||||||
old = *ptr;
|
old = *ptr;
|
||||||
} while( !__sync_bool_compare_and_swap(ptr, old, val) );
|
} while (!__sync_bool_compare_and_swap(ptr, old, val));
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
int32_t atomic_exchange_32_impl(int32_t* ptr, int32_t val ) {
|
int32_t atomic_exchange_32_impl(int32_t* ptr, int32_t val) {
|
||||||
int32_t old;
|
int32_t old;
|
||||||
do {
|
do {
|
||||||
old = *ptr;
|
old = *ptr;
|
||||||
} while( !__sync_bool_compare_and_swap(ptr, old, val) );
|
} while (!__sync_bool_compare_and_swap(ptr, old, val));
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
int64_t atomic_exchange_64_impl(int64_t* ptr, int64_t val ) {
|
int64_t atomic_exchange_64_impl(int64_t* ptr, int64_t val) {
|
||||||
int64_t old;
|
int64_t old;
|
||||||
do {
|
do {
|
||||||
old = *ptr;
|
old = *ptr;
|
||||||
} while( !__sync_bool_compare_and_swap(ptr, old, val) );
|
} while (!__sync_bool_compare_and_swap(ptr, old, val));
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int8_t atomic_load_8(int8_t volatile* ptr) {
|
||||||
int8_t atomic_load_8(int8_t volatile *ptr) {
|
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return (*(int8_t volatile*)(ptr));
|
return (*(int8_t volatile*)(ptr));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -284,7 +253,7 @@ int8_t atomic_load_8(int8_t volatile *ptr) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t atomic_load_16(int16_t volatile *ptr) {
|
int16_t atomic_load_16(int16_t volatile* ptr) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return (*(int16_t volatile*)(ptr));
|
return (*(int16_t volatile*)(ptr));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -294,7 +263,7 @@ int16_t atomic_load_16(int16_t volatile *ptr) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t atomic_load_32(int32_t volatile *ptr) {
|
int32_t atomic_load_32(int32_t volatile* ptr) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return (*(int32_t volatile*)(ptr));
|
return (*(int32_t volatile*)(ptr));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -304,7 +273,7 @@ int32_t atomic_load_32(int32_t volatile *ptr) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t atomic_load_64(int64_t volatile *ptr) {
|
int64_t atomic_load_64(int64_t volatile* ptr) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return (*(int64_t volatile*)(ptr));
|
return (*(int64_t volatile*)(ptr));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -314,7 +283,7 @@ int64_t atomic_load_64(int64_t volatile *ptr) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void* atomic_load_ptr(void *ptr) {
|
void* atomic_load_ptr(void* ptr) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return (*(void* volatile*)(ptr));
|
return (*(void* volatile*)(ptr));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -324,57 +293,57 @@ void* atomic_load_ptr(void *ptr) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void atomic_store_8(int8_t volatile *ptr, int8_t val) {
|
void atomic_store_8(int8_t volatile* ptr, int8_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
((*(int8_t volatile*)(ptr)) = (int8_t)(val));
|
((*(int8_t volatile*)(ptr)) = (int8_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
(*(ptr)=(val));
|
(*(ptr) = (val));
|
||||||
#else
|
#else
|
||||||
__atomic_store_n((ptr), (val), __ATOMIC_SEQ_CST);
|
__atomic_store_n((ptr), (val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void atomic_store_16(int16_t volatile *ptr, int16_t val) {
|
void atomic_store_16(int16_t volatile* ptr, int16_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
((*(int16_t volatile*)(ptr)) = (int16_t)(val));
|
((*(int16_t volatile*)(ptr)) = (int16_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
(*(ptr)=(val));
|
(*(ptr) = (val));
|
||||||
#else
|
#else
|
||||||
__atomic_store_n((ptr), (val), __ATOMIC_SEQ_CST);
|
__atomic_store_n((ptr), (val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void atomic_store_32(int32_t volatile *ptr, int32_t val) {
|
void atomic_store_32(int32_t volatile* ptr, int32_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
((*(int32_t volatile*)(ptr)) = (int32_t)(val));
|
((*(int32_t volatile*)(ptr)) = (int32_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
(*(ptr)=(val));
|
(*(ptr) = (val));
|
||||||
#else
|
#else
|
||||||
__atomic_store_n((ptr), (val), __ATOMIC_SEQ_CST);
|
__atomic_store_n((ptr), (val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void atomic_store_64(int64_t volatile *ptr, int64_t val) {
|
void atomic_store_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
((*(int64_t volatile*)(ptr)) = (int64_t)(val));
|
((*(int64_t volatile*)(ptr)) = (int64_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
(*(ptr)=(val));
|
(*(ptr) = (val));
|
||||||
#else
|
#else
|
||||||
__atomic_store_n((ptr), (val), __ATOMIC_SEQ_CST);
|
__atomic_store_n((ptr), (val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void atomic_store_ptr(void *ptr, void *val) {
|
void atomic_store_ptr(void* ptr, void* val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
((*(void* volatile*)(ptr)) = (void*)(val));
|
((*(void* volatile*)(ptr)) = (void*)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
(*(ptr)=(val));
|
(*(ptr) = (val));
|
||||||
#else
|
#else
|
||||||
__atomic_store_n((void **)(ptr), (val), __ATOMIC_SEQ_CST);
|
__atomic_store_n((void**)(ptr), (val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t atomic_exchange_8(int8_t volatile *ptr, int8_t val) {
|
int8_t atomic_exchange_8(int8_t volatile* ptr, int8_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedExchange8((int8_t volatile*)(ptr), (int8_t)(val));
|
return _InterlockedExchange8((int8_t volatile*)(ptr), (int8_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -384,7 +353,7 @@ int8_t atomic_exchange_8(int8_t volatile *ptr, int8_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t atomic_exchange_16(int16_t volatile *ptr, int16_t val) {
|
int16_t atomic_exchange_16(int16_t volatile* ptr, int16_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedExchange16((int16_t volatile*)(ptr), (int16_t)(val));
|
return _InterlockedExchange16((int16_t volatile*)(ptr), (int16_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -394,7 +363,7 @@ int16_t atomic_exchange_16(int16_t volatile *ptr, int16_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t atomic_exchange_32(int32_t volatile *ptr, int32_t val) {
|
int32_t atomic_exchange_32(int32_t volatile* ptr, int32_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedExchange((int32_t volatile*)(ptr), (int32_t)(val));
|
return _InterlockedExchange((int32_t volatile*)(ptr), (int32_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -404,7 +373,7 @@ int32_t atomic_exchange_32(int32_t volatile *ptr, int32_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t atomic_exchange_64(int64_t volatile *ptr, int64_t val) {
|
int64_t atomic_exchange_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedExchange64((int64_t volatile*)(ptr), (int64_t)(val));
|
return _InterlockedExchange64((int64_t volatile*)(ptr), (int64_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -414,21 +383,21 @@ int64_t atomic_exchange_64(int64_t volatile *ptr, int64_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void* atomic_exchange_ptr(void *ptr, void *val) {
|
void* atomic_exchange_ptr(void* ptr, void* val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
return _InterlockedExchangePointer((void* volatile*)(ptr), (void*)(val));
|
return _InterlockedExchangePointer((void* volatile*)(ptr), (void*)(val));
|
||||||
#else
|
|
||||||
return _InlineInterlockedExchangePointer((void* volatile*)(ptr), (void*)(val));
|
|
||||||
#endif
|
|
||||||
#elif defined(_TD_NINGSI_60)
|
|
||||||
return atomic_exchange_ptr_impl((void *)ptr, (void*)val);
|
|
||||||
#else
|
#else
|
||||||
return __atomic_exchange_n((void **)(ptr), (val), __ATOMIC_SEQ_CST);
|
return _InlineInterlockedExchangePointer((void* volatile*)(ptr), (void*)(val));
|
||||||
|
#endif
|
||||||
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
return atomic_exchange_ptr_impl((void*)ptr, (void*)val);
|
||||||
|
#else
|
||||||
|
return __atomic_exchange_n((void**)(ptr), (val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t atomic_val_compare_exchange_8(int8_t volatile *ptr, int8_t oldval, int8_t newval) {
|
int8_t atomic_val_compare_exchange_8(int8_t volatile* ptr, int8_t oldval, int8_t newval) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedCompareExchange8((int8_t volatile*)(ptr), (int8_t)(newval), (int8_t)(oldval));
|
return _InterlockedCompareExchange8((int8_t volatile*)(ptr), (int8_t)(newval), (int8_t)(oldval));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -438,7 +407,7 @@ int8_t atomic_val_compare_exchange_8(int8_t volatile *ptr, int8_t oldval, int8_t
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t atomic_val_compare_exchange_16(int16_t volatile *ptr, int16_t oldval, int16_t newval) {
|
int16_t atomic_val_compare_exchange_16(int16_t volatile* ptr, int16_t oldval, int16_t newval) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedCompareExchange16((int16_t volatile*)(ptr), (int16_t)(newval), (int16_t)(oldval));
|
return _InterlockedCompareExchange16((int16_t volatile*)(ptr), (int16_t)(newval), (int16_t)(oldval));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -448,7 +417,7 @@ int16_t atomic_val_compare_exchange_16(int16_t volatile *ptr, int16_t oldval, in
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t atomic_val_compare_exchange_32(int32_t volatile *ptr, int32_t oldval, int32_t newval) {
|
int32_t atomic_val_compare_exchange_32(int32_t volatile* ptr, int32_t oldval, int32_t newval) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedCompareExchange((int32_t volatile*)(ptr), (int32_t)(newval), (int32_t)(oldval));
|
return _InterlockedCompareExchange((int32_t volatile*)(ptr), (int32_t)(newval), (int32_t)(oldval));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -458,7 +427,7 @@ int32_t atomic_val_compare_exchange_32(int32_t volatile *ptr, int32_t oldval, in
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t atomic_val_compare_exchange_64(int64_t volatile *ptr, int64_t oldval, int64_t newval) {
|
int64_t atomic_val_compare_exchange_64(int64_t volatile* ptr, int64_t oldval, int64_t newval) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedCompareExchange64((int64_t volatile*)(ptr), (int64_t)(newval), (int64_t)(oldval));
|
return _InterlockedCompareExchange64((int64_t volatile*)(ptr), (int64_t)(newval), (int64_t)(oldval));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -468,17 +437,17 @@ int64_t atomic_val_compare_exchange_64(int64_t volatile *ptr, int64_t oldval, in
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void* atomic_val_compare_exchange_ptr(void *ptr, void *oldval, void *newval) {
|
void* atomic_val_compare_exchange_ptr(void* ptr, void* oldval, void* newval) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedCompareExchangePointer((void* volatile*)(ptr), (void*)(newval), (void*)(oldval));
|
return _InterlockedCompareExchangePointer((void* volatile*)(ptr), (void*)(newval), (void*)(oldval));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
return __sync_val_compare_and_swap(ptr, oldval, newval);
|
return __sync_val_compare_and_swap(ptr, oldval, newval);
|
||||||
#else
|
#else
|
||||||
return __sync_val_compare_and_swap((void **)ptr, oldval, newval);
|
return __sync_val_compare_and_swap((void**)ptr, oldval, newval);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t atomic_add_fetch_8(int8_t volatile *ptr, int8_t val) {
|
int8_t atomic_add_fetch_8(int8_t volatile* ptr, int8_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_add_fetch_8((int8_t volatile*)(ptr), (int8_t)(val));
|
return interlocked_add_fetch_8((int8_t volatile*)(ptr), (int8_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -488,7 +457,7 @@ int8_t atomic_add_fetch_8(int8_t volatile *ptr, int8_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t atomic_add_fetch_16(int16_t volatile *ptr, int16_t val) {
|
int16_t atomic_add_fetch_16(int16_t volatile* ptr, int16_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_add_fetch_16((int16_t volatile*)(ptr), (int16_t)(val));
|
return interlocked_add_fetch_16((int16_t volatile*)(ptr), (int16_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -498,7 +467,7 @@ int16_t atomic_add_fetch_16(int16_t volatile *ptr, int16_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t atomic_add_fetch_32(int32_t volatile *ptr, int32_t val) {
|
int32_t atomic_add_fetch_32(int32_t volatile* ptr, int32_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_add_fetch_32((int32_t volatile*)(ptr), (int32_t)(val));
|
return interlocked_add_fetch_32((int32_t volatile*)(ptr), (int32_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -508,7 +477,7 @@ int32_t atomic_add_fetch_32(int32_t volatile *ptr, int32_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t atomic_add_fetch_64(int64_t volatile *ptr, int64_t val) {
|
int64_t atomic_add_fetch_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_add_fetch_64((int64_t volatile*)(ptr), (int64_t)(val));
|
return interlocked_add_fetch_64((int64_t volatile*)(ptr), (int64_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -518,17 +487,17 @@ int64_t atomic_add_fetch_64(int64_t volatile *ptr, int64_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void* atomic_add_fetch_ptr(void *ptr, void *val) {
|
void* atomic_add_fetch_ptr(void* ptr, void* val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_add_fetch_ptr((void* volatile*)(ptr), (void*)(val));
|
return interlocked_add_fetch_ptr((void* volatile*)(ptr), (void*)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
return __sync_add_and_fetch((ptr), (val));
|
return __sync_add_and_fetch((ptr), (val));
|
||||||
#else
|
#else
|
||||||
return __atomic_add_fetch((void **)(ptr), (size_t)(val), __ATOMIC_SEQ_CST);
|
return __atomic_add_fetch((void**)(ptr), (size_t)(val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t atomic_fetch_add_8(int8_t volatile *ptr, int8_t val) {
|
int8_t atomic_fetch_add_8(int8_t volatile* ptr, int8_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedExchangeAdd8((int8_t volatile*)(ptr), (int8_t)(val));
|
return _InterlockedExchangeAdd8((int8_t volatile*)(ptr), (int8_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -538,7 +507,7 @@ int8_t atomic_fetch_add_8(int8_t volatile *ptr, int8_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t atomic_fetch_add_16(int16_t volatile *ptr, int16_t val) {
|
int16_t atomic_fetch_add_16(int16_t volatile* ptr, int16_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedExchangeAdd16((int16_t volatile*)(ptr), (int16_t)(val));
|
return _InterlockedExchangeAdd16((int16_t volatile*)(ptr), (int16_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -548,7 +517,7 @@ int16_t atomic_fetch_add_16(int16_t volatile *ptr, int16_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t atomic_fetch_add_32(int32_t volatile *ptr, int32_t val) {
|
int32_t atomic_fetch_add_32(int32_t volatile* ptr, int32_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedExchangeAdd((int32_t volatile*)(ptr), (int32_t)(val));
|
return _InterlockedExchangeAdd((int32_t volatile*)(ptr), (int32_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -558,7 +527,7 @@ int32_t atomic_fetch_add_32(int32_t volatile *ptr, int32_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t atomic_fetch_add_64(int64_t volatile *ptr, int64_t val) {
|
int64_t atomic_fetch_add_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedExchangeAdd64((int64_t volatile*)(ptr), (int64_t)(val));
|
return _InterlockedExchangeAdd64((int64_t volatile*)(ptr), (int64_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -568,17 +537,17 @@ int64_t atomic_fetch_add_64(int64_t volatile *ptr, int64_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void* atomic_fetch_add_ptr(void *ptr, void *val) {
|
void* atomic_fetch_add_ptr(void* ptr, void* val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedExchangePointer((void* volatile*)(ptr), (void*)(val));
|
return _InterlockedExchangePointer((void* volatile*)(ptr), (void*)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
return __sync_fetch_and_add((ptr), (val));
|
return __sync_fetch_and_add((ptr), (val));
|
||||||
#else
|
#else
|
||||||
return __atomic_fetch_add((void **)(ptr), (size_t)(val), __ATOMIC_SEQ_CST);
|
return __atomic_fetch_add((void**)(ptr), (size_t)(val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t atomic_sub_fetch_8(int8_t volatile *ptr, int8_t val) {
|
int8_t atomic_sub_fetch_8(int8_t volatile* ptr, int8_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_add_fetch_8((int8_t volatile*)(ptr), -(int8_t)(val));
|
return interlocked_add_fetch_8((int8_t volatile*)(ptr), -(int8_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -588,7 +557,7 @@ int8_t atomic_sub_fetch_8(int8_t volatile *ptr, int8_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t atomic_sub_fetch_16(int16_t volatile *ptr, int16_t val) {
|
int16_t atomic_sub_fetch_16(int16_t volatile* ptr, int16_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_add_fetch_16((int16_t volatile*)(ptr), -(int16_t)(val));
|
return interlocked_add_fetch_16((int16_t volatile*)(ptr), -(int16_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -598,7 +567,7 @@ int16_t atomic_sub_fetch_16(int16_t volatile *ptr, int16_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t atomic_sub_fetch_32(int32_t volatile *ptr, int32_t val) {
|
int32_t atomic_sub_fetch_32(int32_t volatile* ptr, int32_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_sub_fetch_32(ptr, val);
|
return interlocked_sub_fetch_32(ptr, val);
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -608,7 +577,7 @@ int32_t atomic_sub_fetch_32(int32_t volatile *ptr, int32_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t atomic_sub_fetch_64(int64_t volatile *ptr, int64_t val) {
|
int64_t atomic_sub_fetch_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_sub_fetch_64(ptr, val);
|
return interlocked_sub_fetch_64(ptr, val);
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -618,17 +587,17 @@ int64_t atomic_sub_fetch_64(int64_t volatile *ptr, int64_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void* atomic_sub_fetch_ptr(void *ptr, void* val) {
|
void* atomic_sub_fetch_ptr(void* ptr, void* val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_sub_fetch_ptr(ptr, val);
|
return interlocked_sub_fetch_ptr(ptr, val);
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
return __sync_sub_and_fetch((ptr), (val));
|
return __sync_sub_and_fetch((ptr), (val));
|
||||||
#else
|
#else
|
||||||
return __atomic_sub_fetch((void **)(ptr), (val), __ATOMIC_SEQ_CST);
|
return __atomic_sub_fetch((void**)(ptr), (val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t atomic_fetch_sub_8(int8_t volatile *ptr, int8_t val) {
|
int8_t atomic_fetch_sub_8(int8_t volatile* ptr, int8_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedExchangeAdd8((int8_t volatile*)(ptr), -(int8_t)(val));
|
return _InterlockedExchangeAdd8((int8_t volatile*)(ptr), -(int8_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -638,7 +607,7 @@ int8_t atomic_fetch_sub_8(int8_t volatile *ptr, int8_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t atomic_fetch_sub_16(int16_t volatile *ptr, int16_t val) {
|
int16_t atomic_fetch_sub_16(int16_t volatile* ptr, int16_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedExchangeAdd16((int16_t volatile*)(ptr), -(int16_t)(val));
|
return _InterlockedExchangeAdd16((int16_t volatile*)(ptr), -(int16_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -648,7 +617,7 @@ int16_t atomic_fetch_sub_16(int16_t volatile *ptr, int16_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t atomic_fetch_sub_32(int32_t volatile *ptr, int32_t val) {
|
int32_t atomic_fetch_sub_32(int32_t volatile* ptr, int32_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_fetch_sub_32(ptr, val);
|
return interlocked_fetch_sub_32(ptr, val);
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -658,7 +627,7 @@ int32_t atomic_fetch_sub_32(int32_t volatile *ptr, int32_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t atomic_fetch_sub_64(int64_t volatile *ptr, int64_t val) {
|
int64_t atomic_fetch_sub_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedExchangeAdd64((int64_t volatile*)(ptr), -(int64_t)(val));
|
return _InterlockedExchangeAdd64((int64_t volatile*)(ptr), -(int64_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -668,17 +637,17 @@ int64_t atomic_fetch_sub_64(int64_t volatile *ptr, int64_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void* atomic_fetch_sub_ptr(void *ptr, void* val) {
|
void* atomic_fetch_sub_ptr(void* ptr, void* val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_fetch_sub_ptr(ptr, val);
|
return interlocked_fetch_sub_ptr(ptr, val);
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
return __sync_fetch_and_sub((ptr), (val));
|
return __sync_fetch_and_sub((ptr), (val));
|
||||||
#else
|
#else
|
||||||
return __atomic_fetch_sub((void **)(ptr), (val), __ATOMIC_SEQ_CST);
|
return __atomic_fetch_sub((void**)(ptr), (val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t atomic_and_fetch_8(int8_t volatile *ptr, int8_t val) {
|
int8_t atomic_and_fetch_8(int8_t volatile* ptr, int8_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_and_fetch_8((int8_t volatile*)(ptr), (int8_t)(val));
|
return interlocked_and_fetch_8((int8_t volatile*)(ptr), (int8_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -688,7 +657,7 @@ int8_t atomic_and_fetch_8(int8_t volatile *ptr, int8_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t atomic_and_fetch_16(int16_t volatile *ptr, int16_t val) {
|
int16_t atomic_and_fetch_16(int16_t volatile* ptr, int16_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_and_fetch_16((int16_t volatile*)(ptr), (int16_t)(val));
|
return interlocked_and_fetch_16((int16_t volatile*)(ptr), (int16_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -698,7 +667,7 @@ int16_t atomic_and_fetch_16(int16_t volatile *ptr, int16_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t atomic_and_fetch_32(int32_t volatile *ptr, int32_t val) {
|
int32_t atomic_and_fetch_32(int32_t volatile* ptr, int32_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_and_fetch_32((int32_t volatile*)(ptr), (int32_t)(val));
|
return interlocked_and_fetch_32((int32_t volatile*)(ptr), (int32_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -708,7 +677,7 @@ int32_t atomic_and_fetch_32(int32_t volatile *ptr, int32_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t atomic_and_fetch_64(int64_t volatile *ptr, int64_t val) {
|
int64_t atomic_and_fetch_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_and_fetch_64((int64_t volatile*)(ptr), (int64_t)(val));
|
return interlocked_and_fetch_64((int64_t volatile*)(ptr), (int64_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -718,17 +687,17 @@ int64_t atomic_and_fetch_64(int64_t volatile *ptr, int64_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void* atomic_and_fetch_ptr(void *ptr, void *val) {
|
void* atomic_and_fetch_ptr(void* ptr, void* val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_and_fetch_ptr((void* volatile*)(ptr), (void*)(val));
|
return interlocked_and_fetch_ptr((void* volatile*)(ptr), (void*)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
return __sync_and_and_fetch((ptr), (val));
|
return __sync_and_and_fetch((ptr), (val));
|
||||||
#else
|
#else
|
||||||
return __atomic_and_fetch((void **)(ptr), (val), __ATOMIC_SEQ_CST);
|
return __atomic_and_fetch((void**)(ptr), (val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t atomic_fetch_and_8(int8_t volatile *ptr, int8_t val) {
|
int8_t atomic_fetch_and_8(int8_t volatile* ptr, int8_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedAnd8((int8_t volatile*)(ptr), (int8_t)(val));
|
return _InterlockedAnd8((int8_t volatile*)(ptr), (int8_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -738,7 +707,7 @@ int8_t atomic_fetch_and_8(int8_t volatile *ptr, int8_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t atomic_fetch_and_16(int16_t volatile *ptr, int16_t val) {
|
int16_t atomic_fetch_and_16(int16_t volatile* ptr, int16_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedAnd16((int16_t volatile*)(ptr), (int16_t)(val));
|
return _InterlockedAnd16((int16_t volatile*)(ptr), (int16_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -748,7 +717,7 @@ int16_t atomic_fetch_and_16(int16_t volatile *ptr, int16_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t atomic_fetch_and_32(int32_t volatile *ptr, int32_t val) {
|
int32_t atomic_fetch_and_32(int32_t volatile* ptr, int32_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedAnd((int32_t volatile*)(ptr), (int32_t)(val));
|
return _InterlockedAnd((int32_t volatile*)(ptr), (int32_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -758,7 +727,7 @@ int32_t atomic_fetch_and_32(int32_t volatile *ptr, int32_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t atomic_fetch_and_64(int64_t volatile *ptr, int64_t val) {
|
int64_t atomic_fetch_and_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_fetch_and_64((int64_t volatile*)(ptr), (int64_t)(val));
|
return interlocked_fetch_and_64((int64_t volatile*)(ptr), (int64_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -768,17 +737,17 @@ int64_t atomic_fetch_and_64(int64_t volatile *ptr, int64_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void* atomic_fetch_and_ptr(void *ptr, void *val) {
|
void* atomic_fetch_and_ptr(void* ptr, void* val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_fetch_and_ptr((void* volatile*)(ptr), (void*)(val));
|
return interlocked_fetch_and_ptr((void* volatile*)(ptr), (void*)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
return __sync_fetch_and_and((ptr), (val));
|
return __sync_fetch_and_and((ptr), (val));
|
||||||
#else
|
#else
|
||||||
return __atomic_fetch_and((void **)(ptr), (val), __ATOMIC_SEQ_CST);
|
return __atomic_fetch_and((void**)(ptr), (val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t atomic_or_fetch_8(int8_t volatile *ptr, int8_t val) {
|
int8_t atomic_or_fetch_8(int8_t volatile* ptr, int8_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_or_fetch_8((int8_t volatile*)(ptr), (int8_t)(val));
|
return interlocked_or_fetch_8((int8_t volatile*)(ptr), (int8_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -788,7 +757,7 @@ int8_t atomic_or_fetch_8(int8_t volatile *ptr, int8_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t atomic_or_fetch_16(int16_t volatile *ptr, int16_t val) {
|
int16_t atomic_or_fetch_16(int16_t volatile* ptr, int16_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_or_fetch_16((int16_t volatile*)(ptr), (int16_t)(val));
|
return interlocked_or_fetch_16((int16_t volatile*)(ptr), (int16_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -798,7 +767,7 @@ int16_t atomic_or_fetch_16(int16_t volatile *ptr, int16_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t atomic_or_fetch_32(int32_t volatile *ptr, int32_t val) {
|
int32_t atomic_or_fetch_32(int32_t volatile* ptr, int32_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_or_fetch_32((int32_t volatile*)(ptr), (int32_t)(val));
|
return interlocked_or_fetch_32((int32_t volatile*)(ptr), (int32_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -808,7 +777,7 @@ int32_t atomic_or_fetch_32(int32_t volatile *ptr, int32_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t atomic_or_fetch_64(int64_t volatile *ptr, int64_t val) {
|
int64_t atomic_or_fetch_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_or_fetch_64((int64_t volatile*)(ptr), (int64_t)(val));
|
return interlocked_or_fetch_64((int64_t volatile*)(ptr), (int64_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -818,17 +787,17 @@ int64_t atomic_or_fetch_64(int64_t volatile *ptr, int64_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void* atomic_or_fetch_ptr(void *ptr, void *val) {
|
void* atomic_or_fetch_ptr(void* ptr, void* val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_or_fetch_ptr((void* volatile*)(ptr), (void*)(val));
|
return interlocked_or_fetch_ptr((void* volatile*)(ptr), (void*)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
return __sync_or_and_fetch((ptr), (val));
|
return __sync_or_and_fetch((ptr), (val));
|
||||||
#else
|
#else
|
||||||
return __atomic_or_fetch((void **)(ptr), (val), __ATOMIC_SEQ_CST);
|
return __atomic_or_fetch((void**)(ptr), (val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t atomic_fetch_or_8(int8_t volatile *ptr, int8_t val) {
|
int8_t atomic_fetch_or_8(int8_t volatile* ptr, int8_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedOr8((int8_t volatile*)(ptr), (int8_t)(val));
|
return _InterlockedOr8((int8_t volatile*)(ptr), (int8_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -838,7 +807,7 @@ int8_t atomic_fetch_or_8(int8_t volatile *ptr, int8_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t atomic_fetch_or_16(int16_t volatile *ptr, int16_t val) {
|
int16_t atomic_fetch_or_16(int16_t volatile* ptr, int16_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedOr16((int16_t volatile*)(ptr), (int16_t)(val));
|
return _InterlockedOr16((int16_t volatile*)(ptr), (int16_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -848,7 +817,7 @@ int16_t atomic_fetch_or_16(int16_t volatile *ptr, int16_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t atomic_fetch_or_32(int32_t volatile *ptr, int32_t val) {
|
int32_t atomic_fetch_or_32(int32_t volatile* ptr, int32_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedOr((int32_t volatile*)(ptr), (int32_t)(val));
|
return _InterlockedOr((int32_t volatile*)(ptr), (int32_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -858,7 +827,7 @@ int32_t atomic_fetch_or_32(int32_t volatile *ptr, int32_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t atomic_fetch_or_64(int64_t volatile *ptr, int64_t val) {
|
int64_t atomic_fetch_or_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_fetch_or_64((int64_t volatile*)(ptr), (int64_t)(val));
|
return interlocked_fetch_or_64((int64_t volatile*)(ptr), (int64_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -868,17 +837,17 @@ int64_t atomic_fetch_or_64(int64_t volatile *ptr, int64_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void* atomic_fetch_or_ptr(void *ptr, void *val) {
|
void* atomic_fetch_or_ptr(void* ptr, void* val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_fetch_or_ptr((void* volatile*)(ptr), (void*)(val));
|
return interlocked_fetch_or_ptr((void* volatile*)(ptr), (void*)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
return __sync_fetch_and_or((ptr), (val));
|
return __sync_fetch_and_or((ptr), (val));
|
||||||
#else
|
#else
|
||||||
return __atomic_fetch_or((void **)(ptr), (val), __ATOMIC_SEQ_CST);
|
return __atomic_fetch_or((void**)(ptr), (val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t atomic_xor_fetch_8(int8_t volatile *ptr, int8_t val) {
|
int8_t atomic_xor_fetch_8(int8_t volatile* ptr, int8_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_xor_fetch_8((int8_t volatile*)(ptr), (int8_t)(val));
|
return interlocked_xor_fetch_8((int8_t volatile*)(ptr), (int8_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -888,7 +857,7 @@ int8_t atomic_xor_fetch_8(int8_t volatile *ptr, int8_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t atomic_xor_fetch_16(int16_t volatile *ptr, int16_t val) {
|
int16_t atomic_xor_fetch_16(int16_t volatile* ptr, int16_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_xor_fetch_16((int16_t volatile*)(ptr), (int16_t)(val));
|
return interlocked_xor_fetch_16((int16_t volatile*)(ptr), (int16_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -898,7 +867,7 @@ int16_t atomic_xor_fetch_16(int16_t volatile *ptr, int16_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t atomic_xor_fetch_32(int32_t volatile *ptr, int32_t val) {
|
int32_t atomic_xor_fetch_32(int32_t volatile* ptr, int32_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_xor_fetch_32((int32_t volatile*)(ptr), (int32_t)(val));
|
return interlocked_xor_fetch_32((int32_t volatile*)(ptr), (int32_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -908,7 +877,7 @@ int32_t atomic_xor_fetch_32(int32_t volatile *ptr, int32_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t atomic_xor_fetch_64(int64_t volatile *ptr, int64_t val) {
|
int64_t atomic_xor_fetch_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_xor_fetch_64((int64_t volatile*)(ptr), (int64_t)(val));
|
return interlocked_xor_fetch_64((int64_t volatile*)(ptr), (int64_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -918,17 +887,17 @@ int64_t atomic_xor_fetch_64(int64_t volatile *ptr, int64_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void* atomic_xor_fetch_ptr(void *ptr, void *val) {
|
void* atomic_xor_fetch_ptr(void* ptr, void* val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_xor_fetch_ptr((void* volatile*)(ptr), (void*)(val));
|
return interlocked_xor_fetch_ptr((void* volatile*)(ptr), (void*)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
return __sync_xor_and_fetch((ptr), (val));
|
return __sync_xor_and_fetch((ptr), (val));
|
||||||
#else
|
#else
|
||||||
return __atomic_xor_fetch((void **)(ptr), (val), __ATOMIC_SEQ_CST);
|
return __atomic_xor_fetch((void**)(ptr), (val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t atomic_fetch_xor_8(int8_t volatile *ptr, int8_t val) {
|
int8_t atomic_fetch_xor_8(int8_t volatile* ptr, int8_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedXor8((int8_t volatile*)(ptr), (int8_t)(val));
|
return _InterlockedXor8((int8_t volatile*)(ptr), (int8_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -938,7 +907,7 @@ int8_t atomic_fetch_xor_8(int8_t volatile *ptr, int8_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t atomic_fetch_xor_16(int16_t volatile *ptr, int16_t val) {
|
int16_t atomic_fetch_xor_16(int16_t volatile* ptr, int16_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedXor16((int16_t volatile*)(ptr), (int16_t)(val));
|
return _InterlockedXor16((int16_t volatile*)(ptr), (int16_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -948,7 +917,7 @@ int16_t atomic_fetch_xor_16(int16_t volatile *ptr, int16_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t atomic_fetch_xor_32(int32_t volatile *ptr, int32_t val) {
|
int32_t atomic_fetch_xor_32(int32_t volatile* ptr, int32_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return _InterlockedXor((int32_t volatile*)(ptr), (int32_t)(val));
|
return _InterlockedXor((int32_t volatile*)(ptr), (int32_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -958,7 +927,7 @@ int32_t atomic_fetch_xor_32(int32_t volatile *ptr, int32_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t atomic_fetch_xor_64(int64_t volatile *ptr, int64_t val) {
|
int64_t atomic_fetch_xor_64(int64_t volatile* ptr, int64_t val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_fetch_xor_64((int64_t volatile*)(ptr), (int64_t)(val));
|
return interlocked_fetch_xor_64((int64_t volatile*)(ptr), (int64_t)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
|
@ -968,13 +937,12 @@ int64_t atomic_fetch_xor_64(int64_t volatile *ptr, int64_t val) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void* atomic_fetch_xor_ptr(void *ptr, void *val) {
|
void* atomic_fetch_xor_ptr(void* ptr, void* val) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return interlocked_fetch_xor_ptr((void* volatile*)(ptr), (void*)(val));
|
return interlocked_fetch_xor_ptr((void* volatile*)(ptr), (void*)(val));
|
||||||
#elif defined(_TD_NINGSI_60)
|
#elif defined(_TD_NINGSI_60)
|
||||||
return __sync_fetch_and_xor((ptr), (val));
|
return __sync_fetch_and_xor((ptr), (val));
|
||||||
#else
|
#else
|
||||||
return __atomic_fetch_xor((void **)(ptr), (val), __ATOMIC_SEQ_CST);
|
return __atomic_fetch_xor((void**)(ptr), (val), __ATOMIC_SEQ_CST);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue