提交 5eaae4f7 编写于 作者: 陶建辉(Jeff)'s avatar 陶建辉(Jeff)

add more trace for tqueue

上级 534d3c24
......@@ -61,6 +61,7 @@ taos_queue taosOpenQueue() {
pthread_mutex_init(&queue->mutex, NULL);
uTrace("queue:%p is openned", queue);
return queue;
}
......@@ -89,6 +90,8 @@ void taosCloseQueue(taos_queue param) {
pthread_mutex_unlock(&queue->mutex);
pthread_mutex_destroy(&queue->mutex);
free(queue);
uTrace("queue:%p is closed", queue);
}
void *taosAllocateQitem(int size) {
......@@ -161,7 +164,7 @@ int taosReadQitem(taos_queue param, int *type, void **pitem) {
}
void *taosAllocateQall() {
void *p = malloc(sizeof(STaosQall));
void *p = calloc(sizeof(STaosQall), 1);
return p;
}
......@@ -230,6 +233,7 @@ taos_qset taosOpenQset() {
pthread_mutex_init(&qset->mutex, NULL);
tsem_init(&qset->sem, 0, 0);
uTrace("qset:%p is openned", qset);
return qset;
}
......@@ -239,6 +243,7 @@ void taosCloseQset(taos_qset param) {
pthread_mutex_destroy(&qset->mutex);
tsem_destroy(&qset->sem);
free(qset);
uTrace("qset:%p is closed", qset);
}
// tsem_post 'qset->sem', so that reader threads waiting for it
......@@ -269,6 +274,7 @@ int taosAddIntoQset(taos_qset p1, taos_queue p2, void *ahandle) {
pthread_mutex_unlock(&qset->mutex);
uTrace("queue:%p is added into qset:%p", queue, qset);
return 0;
}
......@@ -288,6 +294,7 @@ void taosRemoveFromQset(taos_qset p1, taos_queue p2) {
STaosQueue *prev = qset->head;
tqueue = qset->head->next;
while (tqueue) {
assert(tqueue->qset);
if (tqueue== queue) {
prev->next = tqueue->next;
break;
......@@ -310,6 +317,8 @@ void taosRemoveFromQset(taos_qset p1, taos_queue p2) {
}
pthread_mutex_unlock(&qset->mutex);
uTrace("queue:%p is removed from qset:%p", queue, qset);
}
int taosGetQueueNumber(taos_qset param) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册