Merge pull request #4478 from taosdata/bugfix/td-2373
[TD-2373]<fix>: data race in removeFromWheel
This commit is contained in:
commit
0a779c7467
|
@ -225,10 +225,11 @@ static void addToWheel(tmr_obj_t* timer, uint32_t delay) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool removeFromWheel(tmr_obj_t* timer) {
|
static bool removeFromWheel(tmr_obj_t* timer) {
|
||||||
if (timer->wheel >= tListLen(wheels)) {
|
uint8_t wheelIdx = timer->wheel;
|
||||||
|
if (wheelIdx >= tListLen(wheels)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
time_wheel_t* wheel = wheels + timer->wheel;
|
time_wheel_t* wheel = wheels + wheelIdx;
|
||||||
|
|
||||||
bool removed = false;
|
bool removed = false;
|
||||||
pthread_mutex_lock(&wheel->mutex);
|
pthread_mutex_lock(&wheel->mutex);
|
||||||
|
|
Loading…
Reference in New Issue