#ifndef PROTOTYPE1_SRC_L1_SYSTEM_PTHREAD_H
#define PROTOTYPE1_SRC_L1_SYSTEM_PTHREAD_H

#include "../core/util.h"
#include <pthread.h>

void safe_pthread_mutex_lock(pthread_mutex_t* mut) {
    if (pthread_mutex_lock(mut))
        abortf("O_o\n");
}

void safe_pthread_mutex_unlock(pthread_mutex_t *mut) {
    if (pthread_mutex_unlock(mut))
        abortf("O_o\n");
}

void safe_pthread_mutex_init(pthread_mutex_t* place, const pthread_mutexattr_t* attr) {
    if (pthread_mutex_init(place, attr))
        abortf("pthread_mutex_init\n");
}

void safe_pthread_mutex_destroy(pthread_mutex_t* mut) {
    if (pthread_mutex_destroy(mut))
        abortf("O_O\n");
}

void safe_pthread_join(pthread_t thread) {
    pthread_join(thread, NULL);
}


#endif