summaryrefslogtreecommitdiff
path: root/linen.h
blob: 90621119f1008534616fac96775f4ce1088dd712 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef _LINEN_H_
#define _LINEN_H_

#if (__x86_64 != 1 || __linux__ != 1 || __LP64__ != 1)
	#error "Linen (libinen.so) only works on x86_64 Linux!"
#endif

#include <stdint.h>


typedef struct {
	uint32_t futex;
	uint32_t magic;
} *linen_thread_t;

extern int linen_thread_create(linen_thread_t* handle, void* (*func)(void*), void* arg);
extern int linen_thread_finish(linen_thread_t  handle, void** retval);


typedef struct {
	uint32_t futex;
	uint32_t count;
	uint32_t magic;
} linen_lock_t;

#define LINEN_LOCK_INITIALIZER { 0, 0, 0xCAFEBABE }

extern int linen_lock_acquire(linen_lock_t* handle);
extern int linen_lock_release(linen_lock_t* handle);


#endif /* _LINEN_H_ */