双向链表

APUE 308页 线程学习时候有一个链表

struct job{
    struct job* next;
    struct job* prev;
    pthread_t id;
}

struct queue(){
    struct job * head;
    struct job * tail;
    pthread_rwlock_t q_lock;
}

当一个节点没有时候
q->head=NULL
q->tail = NULL

当有一个节点A时候

q->head = A;
q->tail = A;

A->next = NULL;
A->prev = NULL;

当有两个A,B节点时
q->head = A
q->tail = B
这里写图片描写叙述

原文地址:https://www.cnblogs.com/yxwkf/p/5059119.html