stmt2/async: new flag semWaited for the current batch
This commit is contained in:
parent
9ad2b9d96a
commit
e7cfe21e72
|
@ -150,10 +150,10 @@ typedef struct {
|
|||
SStmtExecInfo exec;
|
||||
SStmtBindInfo bInfo;
|
||||
|
||||
int64_t reqid;
|
||||
int32_t errCode;
|
||||
tsem_t asyncQuerySem;
|
||||
|
||||
int64_t reqid;
|
||||
int32_t errCode;
|
||||
tsem_t asyncQuerySem;
|
||||
bool semWaited;
|
||||
SStmtStatInfo stat;
|
||||
} STscStmt2;
|
||||
/*
|
||||
|
|
|
@ -1984,8 +1984,9 @@ int taos_stmt2_bind_param(TAOS_STMT2 *stmt, TAOS_STMT2_BINDV *bindv, int32_t col
|
|||
}
|
||||
|
||||
STscStmt2 *pStmt = (STscStmt2 *)stmt;
|
||||
if (pStmt->options.asyncExecFn) {
|
||||
if (pStmt->options.asyncExecFn && !pStmt->semWaited) {
|
||||
(void)tsem_wait(&pStmt->asyncQuerySem);
|
||||
pStmt->semWaited = true;
|
||||
}
|
||||
|
||||
int32_t code = 0;
|
||||
|
|
|
@ -819,6 +819,7 @@ TAOS_STMT2* stmtInit2(STscObj* taos, TAOS_STMT2_OPTION* pOptions) {
|
|||
if (pStmt->options.asyncExecFn) {
|
||||
(void)tsem_init(&pStmt->asyncQuerySem, 0, 1);
|
||||
}
|
||||
pStmt->semWaited = false;
|
||||
|
||||
STMT_LOG_SEQ(STMT_INIT);
|
||||
|
||||
|
@ -1678,6 +1679,7 @@ int stmtExec2(TAOS_STMT2* stmt, int* affected_rows) {
|
|||
pRequest->body.queryFp = asyncQueryCb;
|
||||
((SSyncQueryParam*)(pRequest)->body.interParam)->userParam = pStmt;
|
||||
|
||||
pStmt->semWaited = false;
|
||||
launchAsyncQuery(pRequest, pStmt->sql.pQuery, NULL, pWrapper);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue