Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Concurrencia
Concurrencia
1. struct QNode {
2. int key;
3. struct QNode* next;
4. };
5. struct Queue {
6. struct QNode *front, *rear;
7. };
8. void deQueue(struct Queue* q){
9. if (q->front == NULL)
10. return;
11.
12. struct QNode* temp = q->front;
13. q->front = q->front->next;
14.
15. if (q->front == NULL)
16. q->rear = NULL;
17.
18. free(temp);
19. }
1. struct QNode {
2. int key;
3. struct QNode* next;
4. };
5.
6. struct Queue {
7. struct QNode *front, *rear;
8. };
9.
10. void deQueue(struct Queue* q){
11. lock(q);
12.
13. if (q->front == NULL)
14. unlock(q);
15. return;
16.
17. struct QNode* temp = q->front;
18. q->front = q->front->next;
19.
20. if (q->front == NULL)
21. q->rear = NULL;
22.
23. free(temp);
24. unlock(q);
25. }