minor changes

This commit is contained in:
Shengliang Guan 2022-02-28 14:31:57 +08:00
parent 869d3c1742
commit 4cbfc4f82b
5 changed files with 44 additions and 39 deletions

View File

@ -13,8 +13,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef _TD_UTIL_VERSION_H #ifndef _TD_UTIL_VERSION_H_
#define _TD_UTIL_VERSION_H #define _TD_UTIL_VERSION_H_
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -28,4 +28,4 @@ int32_t taosCheckVersionCompatible(int32_t clientVer, int32_t serverVer, int32_t
} }
#endif #endif
#endif /*_TD_UTIL_VERSION_H*/ #endif /*_TD_UTIL_VERSION_H_*/

View File

@ -13,8 +13,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef _TD_UTIL_WORKER_H #ifndef _TD_UTIL_WORKER_H_
#define _TD_UTIL_WORKER_H #define _TD_UTIL_WORKER_H_
#include "tqueue.h" #include "tqueue.h"
#ifdef __cplusplus #ifdef __cplusplus
@ -34,25 +34,25 @@ typedef struct SQWorkerPool {
int32_t max; // max number of workers int32_t max; // max number of workers
int32_t min; // min number of workers int32_t min; // min number of workers
int32_t num; // current number of workers int32_t num; // current number of workers
STaosQset * qset; STaosQset *qset;
const char * name; const char *name;
SQWorker * workers; SQWorker *workers;
pthread_mutex_t mutex; pthread_mutex_t mutex;
} SQWorkerPool, SFWorkerPool; } SQWorkerPool, SFWorkerPool;
typedef struct SWWorker { typedef struct SWWorker {
int32_t id; // worker id int32_t id; // worker id
pthread_t thread; // thread pthread_t thread; // thread
STaosQall * qall; STaosQall *qall;
STaosQset * qset; // queue set STaosQset *qset; // queue set
SWWorkerPool *pool; SWWorkerPool *pool;
} SWWorker; } SWWorker;
typedef struct SWWorkerPool { typedef struct SWWorkerPool {
int32_t max; // max number of workers int32_t max; // max number of workers
int32_t nextId; // from 0 to max-1, cyclic int32_t nextId; // from 0 to max-1, cyclic
const char * name; const char *name;
SWWorker * workers; SWWorker *workers;
pthread_mutex_t mutex; pthread_mutex_t mutex;
} SWWorkerPool; } SWWorkerPool;
@ -75,4 +75,4 @@ void tWWorkerFreeQueue(SWWorkerPool *pool, STaosQueue *queue);
} }
#endif #endif
#endif /*_TD_UTIL_WORKER_H*/ #endif /*_TD_UTIL_WORKER_H_*/

View File

@ -22,14 +22,14 @@
extern "C" { extern "C" {
#endif #endif
#define GET_INT8_VAL(x) (*(int8_t *)(x)) #define GET_INT8_VAL(x) (*(int8_t *)(x))
#define GET_INT16_VAL(x) (*(int16_t *)(x)) #define GET_INT16_VAL(x) (*(int16_t *)(x))
#define GET_INT32_VAL(x) (*(int32_t *)(x)) #define GET_INT32_VAL(x) (*(int32_t *)(x))
#define GET_INT64_VAL(x) (*(int64_t *)(x)) #define GET_INT64_VAL(x) (*(int64_t *)(x))
#define GET_UINT8_VAL(x) (*(uint8_t*) (x)) #define GET_UINT8_VAL(x) (*(uint8_t *)(x))
#define GET_UINT16_VAL(x) (*(uint16_t *)(x)) #define GET_UINT16_VAL(x) (*(uint16_t *)(x))
#define GET_UINT32_VAL(x) (*(uint32_t *)(x)) #define GET_UINT32_VAL(x) (*(uint32_t *)(x))
#define GET_UINT64_VAL(x) (*(uint64_t *)(x)) #define GET_UINT64_VAL(x) (*(uint64_t *)(x))
static FORCE_INLINE float taos_align_get_float(const char *pBuf) { static FORCE_INLINE float taos_align_get_float(const char *pBuf) {
#if __STDC_VERSION__ >= 201112L #if __STDC_VERSION__ >= 201112L
@ -64,17 +64,22 @@ static FORCE_INLINE double taos_align_get_double(const char *pBuf) {
// #define SET_FLOAT_PTR(x, y) { (*(int32_t*) x = *(int32_t*)y); } // #define SET_FLOAT_PTR(x, y) { (*(int32_t*) x = *(int32_t*)y); }
// #define SET_DOUBLE_PTR(x, y) { (*(int64_t*) x = *(int64_t*)y); } // #define SET_DOUBLE_PTR(x, y) { (*(int64_t*) x = *(int64_t*)y); }
// #else // #else
#define GET_FLOAT_VAL(x) (*(float *)(x)) #define GET_FLOAT_VAL(x) (*(float *)(x))
#define GET_DOUBLE_VAL(x) (*(double *)(x)) #define GET_DOUBLE_VAL(x) (*(double *)(x))
#define SET_BIGINT_VAL(x, y) { (*(int64_t *)(x)) = (int64_t)(y); } #define SET_BIGINT_VAL(x, y) \
#define SET_FLOAT_VAL(x, y) { (*(float *)(x)) = (float)(y); } { (*(int64_t *)(x)) = (int64_t)(y); }
#define SET_DOUBLE_VAL(x, y) { (*(double *)(x)) = (double)(y); } #define SET_FLOAT_VAL(x, y) \
#define SET_FLOAT_PTR(x, y) { (*(float *)(x)) = (*(float *)(y)); } { (*(float *)(x)) = (float)(y); }
#define SET_DOUBLE_PTR(x, y) { (*(double *)(x)) = (*(double *)(y)); } #define SET_DOUBLE_VAL(x, y) \
{ (*(double *)(x)) = (double)(y); }
#define SET_FLOAT_PTR(x, y) \
{ (*(float *)(x)) = (*(float *)(y)); }
#define SET_DOUBLE_PTR(x, y) \
{ (*(double *)(x)) = (*(double *)(y)); }
// #endif // #endif
typedef uint16_t VarDataLenT; // maxVarDataLen: 32767 typedef uint16_t VarDataLenT; // maxVarDataLen: 32767
#define VARSTR_HEADER_SIZE sizeof(VarDataLenT) #define VARSTR_HEADER_SIZE sizeof(VarDataLenT)
#define varDataLen(v) ((VarDataLenT *)(v))[0] #define varDataLen(v) ((VarDataLenT *)(v))[0]
#define varDataVal(v) ((void *)((char *)v + VARSTR_HEADER_SIZE)) #define varDataVal(v) ((void *)((char *)v + VARSTR_HEADER_SIZE))

View File

@ -13,8 +13,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef _TD_UTIL_VERSION_H #ifndef _TD_UTIL_VERSION_H_
#define _TD_UTIL_VERSION_H #define _TD_UTIL_VERSION_H_
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -30,4 +30,4 @@ extern char buildinfo[];
} }
#endif #endif
#endif /*_TD_UTIL_VERSION_H*/ #endif /*_TD_UTIL_VERSION_H_*/

View File

@ -71,8 +71,8 @@ static void *tQWorkerThreadFp(SQWorker *worker) {
SQWorkerPool *pool = worker->pool; SQWorkerPool *pool = worker->pool;
FItem fp = NULL; FItem fp = NULL;
void * msg = NULL; void *msg = NULL;
void * ahandle = NULL; void *ahandle = NULL;
int32_t code = 0; int32_t code = 0;
taosBlockSIGPIPE(); taosBlockSIGPIPE();
@ -151,8 +151,8 @@ static void *tFWorkerThreadFp(SQWorker *worker) {
SQWorkerPool *pool = worker->pool; SQWorkerPool *pool = worker->pool;
FItem fp = NULL; FItem fp = NULL;
void * msg = NULL; void *msg = NULL;
void * ahandle = NULL; void *ahandle = NULL;
int32_t code = 0; int32_t code = 0;
taosBlockSIGPIPE(); taosBlockSIGPIPE();
@ -240,8 +240,8 @@ static void *tWWorkerThreadFp(SWWorker *worker) {
SWWorkerPool *pool = worker->pool; SWWorkerPool *pool = worker->pool;
FItems fp = NULL; FItems fp = NULL;
void * msg = NULL; void *msg = NULL;
void * ahandle = NULL; void *ahandle = NULL;
int32_t numOfMsgs = 0; int32_t numOfMsgs = 0;
int32_t qtype = 0; int32_t qtype = 0;