@
RedisMasterNode main 线程往 io_threads_list 写,io thread 读 io_threads_list ,比如
main thread 执行完下面标记的一行后,线程切换到了 io thread,io thread 遍历 io_threads_list[i],那么 node 的 prev,next 指针都没有被设置,这里就出现野指针了
list *listAddNodeTail(list *list, void *value)
{
listNode *node;
if ((node = zmalloc(sizeof(*node))) == NULL)
return NULL;
node->value = value;
if (list->len == 0) {
list->head = list->tail = node; // 这一行
node->prev = node->next = NULL;
} else {
node->prev = list->tail;
node->next = NULL;
list->tail->next = node;
list->tail = node;
}
list->len++;
return list;
}