projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use threads for UDP sockets.
[tinc]
/
src
/
threads.h
diff --git
a/src/threads.h
b/src/threads.h
index
3243907
..
d2ef4a6
100644
(file)
--- a/
src/threads.h
+++ b/
src/threads.h
@@
-1,11
+1,6
@@
#ifndef __THREADS_H__
#define __THREADS_H__
#ifndef __THREADS_H__
#define __THREADS_H__
-typedef struct event {
- int foo;
-} event_t;
-
-
#ifdef HAVE_MINGW
typedef HANDLE thread_t;
typedef CRITICAL_SECTION mutex_t;
#ifdef HAVE_MINGW
typedef HANDLE thread_t;
typedef CRITICAL_SECTION mutex_t;
@@
-33,11
+28,11
@@
static inline void mutex_unlock(mutex_t *mutex) {
typedef pthread_t thread_t;
typedef pthread_mutex_t mutex_t;
typedef pthread_t thread_t;
typedef pthread_mutex_t mutex_t;
-static inline
void
thread_create(thread_t *tid, void (*func)(void *), void *arg) {
+static inline
bool
thread_create(thread_t *tid, void (*func)(void *), void *arg) {
return !pthread_create(tid, NULL, (void *(*)(void *))func, arg);
}
static inline void thread_destroy(thread_t *tid) {
return !pthread_create(tid, NULL, (void *(*)(void *))func, arg);
}
static inline void thread_destroy(thread_t *tid) {
- pthread_join(
tid
);
+ pthread_join(
*tid, NULL
);
}
static inline void mutex_create(mutex_t *mutex) {
pthread_mutex_init(mutex, NULL);
}
static inline void mutex_create(mutex_t *mutex) {
pthread_mutex_init(mutex, NULL);