summaryrefslogtreecommitdiff
path: root/mt.h
blob: 57afd5c626e5e1381bcf710bd97bada0e6288ce9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#pragma once

#include <pthread.h>


// The structs in this file should be considered opaque.


struct mt_mutex {
	pthread_mutex_t m;
};

void mt_mutex_init(struct mt_mutex *mut);
void mt_mutex_destroy(struct mt_mutex *mut);
void mt_mutex_lock(struct mt_mutex *mut);
void mt_mutex_unlock(struct mt_mutex *mut);

struct mt_thread {
	pthread_t t;
};

void mt_thread_create(struct mt_thread *th, void* (*callback)(void*), void *arg);
void* mt_thread_join(struct mt_thread *th);