logo

Crowdly

Consider the following code to initialize the concurrent Michael and Scott Queue...

✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.

Consider the following code to initialize the concurrent Michael and Scott Queue from class.

void Queue_Init(queue_t *q) {

node_t *tmp = malloc(sizeof(node_t));

tmp->next = NULL;

q->head = q->tail = tmp;

pthread_mutex_init(&q->headLock, NULL);

pthread_mutex_init(&q->tailLock, NULL);

}

Why does an empty queue have a node allocated?

Більше питань подібних до цього

Хочете миттєвий доступ до всіх перевірених відповідей на moodle31.upei.ca?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!