提交 c90ea801 编写于 作者: B Bomin Zhang

[TD-2373]<fix>: data race in removeFromWheel

上级 48ba8aeb
...@@ -225,10 +225,11 @@ static void addToWheel(tmr_obj_t* timer, uint32_t delay) { ...@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册