aboutsummaryrefslogtreecommitdiff
path: root/bikewedge/software/RetoolingForOpenSprints/serproxy-0.1.3.src/thread.h
diff options
context:
space:
mode:
Diffstat (limited to 'bikewedge/software/RetoolingForOpenSprints/serproxy-0.1.3.src/thread.h')
-rw-r--r--bikewedge/software/RetoolingForOpenSprints/serproxy-0.1.3.src/thread.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/bikewedge/software/RetoolingForOpenSprints/serproxy-0.1.3.src/thread.h b/bikewedge/software/RetoolingForOpenSprints/serproxy-0.1.3.src/thread.h
new file mode 100644
index 0000000..c741c51
--- /dev/null
+++ b/bikewedge/software/RetoolingForOpenSprints/serproxy-0.1.3.src/thread.h
@@ -0,0 +1,44 @@
+#ifndef THREAD_H
+#define THREAD_H
+
+#if defined(__UNIX__)
+# define PTHREADS
+#elif defined(__WIN32__)
+# define WINTHREADS
+#endif
+
+#if defined(PTHREADS)
+
+# include <pthread.h>
+typedef pthread_t thr_t;
+typedef pthread_mutex_t thr_mutex_t;
+typedef void * thr_exitcode_t;
+typedef void *(*thr_startfunc_ptr_t)(void *);
+typedef void * thr_startfunc_t;
+
+#elif defined(WINTHREADS)
+
+# include <windows.h>
+typedef HANDLE thr_t;
+typedef HANDLE thr_mutex_t;
+typedef DWORD thr_exitcode_t;
+typedef LPTHREAD_START_ROUTINE thr_startfunc_ptr_t;
+#define thr_startfunc_t thr_exitcode_t WINAPI
+#endif
+
+int thr_create(thr_t *thread, int detached,
+ thr_startfunc_ptr_t startfunc, void *arg);
+int thr_cancel(thr_t thread);
+void thr_exit(thr_exitcode_t retval);
+thr_t thr_self(void);
+int thr_equal(thr_t thread1, thr_t thread2);
+int thr_join(thr_t thread, thr_exitcode_t *retval);
+int thr_detach(thr_t thread);
+
+thr_mutex_t thr_mutex_create(void);
+int thr_mutex_destroy(thr_mutex_t *mutex);
+int thr_mutex_lock(thr_mutex_t *mutex);
+int thr_mutex_trylock(thr_mutex_t *mutex);
+int thr_mutex_unlock(thr_mutex_t *mutex);
+
+#endif /* THREAD_H */