From 9fe82926e2b75526f6752d82baf7af792f31dbe5 Mon Sep 17 00:00:00 2001 From: Olaf Matthes Date: Fri, 1 Dec 2006 16:04:37 +0000 Subject: added threading for 'open' and 'close', needs more work but shows that open is a blocking function that takes ages to complete on first call svn path=/trunk/externals/io/hidio/; revision=6561 --- hidio.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'hidio.h') diff --git a/hidio.h b/hidio.h index 3a2a670..9461358 100644 --- a/hidio.h +++ b/hidio.h @@ -3,6 +3,7 @@ #include #include +#include #ifdef __linux__ #include @@ -34,7 +35,7 @@ typedef void t_clock; #define HIDIO_MAJOR_VERSION 0 #define HIDIO_MINOR_VERSION 0 -/* static char *version = "$Revision: 1.2 $"; */ +/* static char *version = "$Revision: 1.3 $"; */ /*------------------------------------------------------------------------------ * GLOBAL DEFINES @@ -52,6 +53,18 @@ typedef void t_clock; * events from the OS's event queue */ #define MAX_EVENTS_PER_POLL 64 +/*------------------------------------------------------------------------------ + * THREADING RELATED DEFINES + */ + +#define REQUEST_NOTHING 0 +#define REQUEST_OPEN 1 +#define REQUEST_READ 2 +#define REQUEST_SEND 3 +#define REQUEST_CLOSE 4 +#define REQUEST_QUIT 5 + + /*------------------------------------------------------------------------------ * CLASS DEF */ @@ -73,6 +86,11 @@ typedef struct _hidio t_clock *x_clock; t_outlet *x_data_outlet; t_outlet *x_status_outlet; + t_int x_requestcode; + pthread_mutex_t x_mutex; + pthread_cond_t x_requestcondition; + pthread_cond_t x_answercondition; + pthread_t x_thread; } t_hidio; -- cgit v1.2.1