Esempio n. 1
0
void network_stop()
{
	network_on = 0;
	pthread_join(recv_thread, NULL);
	LOGD("thread joined");

	pthread_mutex_destroy(&write_lock);
	LOGD("mutex destroyed");

	cq_destroy(video_cq);
	cq_destroy(audio_cq);
}
Esempio n. 2
0
void print_levelbylevel(ptr_rbnode root) {
    CircularQueue *cq;
    cq_init(cq, ELEMENT_MAX);

    cq_push(cq, root);
    int depth_cnt = -1;
    while ((depth_cnt = cq->capacity)) {

        while (depth_cnt--) {
            cq_element_t current_node = cq_front(cq);
            cq_pop(cq);
            if (current_node->nil) {
                printf("N ");
            }
            else {
                printf("%d%s ", current_node->val, current_node->color ? "(B)" : "(R)");
                cq_push(cq, current_node->left);
                cq_push(cq, current_node->right);
            }
        }
        printf("\n");
    }
    cq_destroy(cq);
}