From cc74b689fc76d8dae9c3e82ef702fc10baf8209a Mon Sep 17 00:00:00 2001 From: Jeff Tao Date: Tue, 10 Nov 2020 13:00:31 +0000 Subject: [PATCH] add some notes on tqueue.c --- src/util/inc/tqueue.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/util/inc/tqueue.h b/src/util/inc/tqueue.h index 8493a64315..c3051464e5 100644 --- a/src/util/inc/tqueue.h +++ b/src/util/inc/tqueue.h @@ -20,6 +20,23 @@ extern "C" { #endif +/* + +This set of API for queue is designed specially for vnode/mnode. The main purpose is to +consume all the items instead of one item from a queue by one single read. Also, it can +combine multiple queues into a queue set, a consumer thread can consume a queue set via +a single API instead of looping every queue by itself. + +Notes: +1: taosOpenQueue/taosCloseQueue, taosOpenQset/taosCloseQset is NOT multi-thread safe +2: after taosCloseQueue/taosCloseQset is called, read/write operation APIs are not safe. +3: read/write operation APIs are multi-thread safe + +To remove the limitation and make this set of queue APIs multi-thread safe, REF(tref.c) +shall be used to set up the protection. + +*/ + typedef void* taos_queue; typedef void* taos_qset; typedef void* taos_qall; -- GitLab