pthread_queue tosignal; pthread_descr th;
pthread_descr tosignal, th;
int pthread_cond_broadcast(pthread_cond_t *cond){  pthread_queue tosignal;  pthread_descr th;  acquire(&cond->c_spinlock);  /* Copy the current state of the waiting queue and empty it */  tosignal = cond->c_waiting;  queue_init(&cond->c_waiting);  release(&cond->c_spinlock);  /* Now signal each process in the queue */  while ((th = dequeue(&tosignal)) != NULL) restart(th);  return 0;}