Example #1
0
void ordered_map_file_close(OrderedMapFile *omf) {
    if (omf) {
        if (!omf->mutex.error() && !omf->cond.error() && !omf->queue.error()) {
            ordered_map_file_flush(omf);
            omf->running = false;
            omf->queue.wakeup_all();
        }
        omf->write_thread.join();
        if (omf->file)
            fclose(omf->file);
        destroy_list(omf);
        destroy_map(omf);
        destroy(omf, 1);
    }
}
Example #2
0
void ordered_map_file_close(OrderedMapFile *omf) {
    if (!omf)
        return;

    if (omf->mutex && omf->cond && !omf->queue.error()) {
        ordered_map_file_flush(omf);
        omf->running = false;
        omf->queue.wakeup_all();
    }
    os_thread_destroy(omf->write_thread);
    if (omf->file)
        fclose(omf->file);
    destroy_list(omf);
    destroy_map(omf);

    os_mutex_destroy(omf->mutex);
    os_cond_destroy(omf->cond);

    destroy(omf, 1);
}