diff --git a/ruamoko/qwaq/main.c b/ruamoko/qwaq/main.c index 2368c2fc9..45da8847e 100644 --- a/ruamoko/qwaq/main.c +++ b/ruamoko/qwaq/main.c @@ -239,12 +239,14 @@ start_progs_thread (qwaq_thread_t *thread) } qwaq_thread_t * -create_thread (void *(*thread_func) (void *)) +create_thread (void *(*thread_func) (qwaq_thread_t *), void *data) { qwaq_thread_t *thread = calloc (1, sizeof (*thread)); + thread->data = data; DARRAY_APPEND (&thread_data, thread); - pthread_create (&thread->thread_id, 0, thread_func, thread); + pthread_create (&thread->thread_id, 0, + (void*(*)(void*))thread_func, thread); return thread; } diff --git a/ruamoko/qwaq/qwaq-curses.c b/ruamoko/qwaq/qwaq-curses.c index 1318445b3..4503645d2 100644 --- a/ruamoko/qwaq/qwaq-curses.c +++ b/ruamoko/qwaq/qwaq-curses.c @@ -1553,11 +1553,9 @@ bi_mvwblit_line (progs_t *pr) } static void * -qwaq_curses_thread (void *data) +qwaq_curses_thread (qwaq_thread_t *thread) { - __auto_type thread = (qwaq_thread_t *) data; - progs_t *pr = thread->pr; - qwaq_resources_t *res = PR_Resources_Find (pr, "qwaq"); + qwaq_resources_t *res = thread->data; while (1) { process_commands (res); @@ -1587,7 +1585,7 @@ bi_initialize (progs_t *pr) res->stdscr.win = stdscr; - create_thread (qwaq_curses_thread); + create_thread (qwaq_curses_thread, res); } static void diff --git a/ruamoko/qwaq/qwaq.h b/ruamoko/qwaq/qwaq.h index f89f529e8..f0974e61c 100644 --- a/ruamoko/qwaq/qwaq.h +++ b/ruamoko/qwaq/qwaq.h @@ -10,10 +10,11 @@ typedef struct qwaq_thread_s { sys_printf_t sys_printf; progs_t *pr; func_t main_func; + void *data; } qwaq_thread_t; void BI_Init (progs_t *pr); extern struct cbuf_s *qwaq_cbuf; -qwaq_thread_t *create_thread (void *(*thread_func) (void *)); +qwaq_thread_t *create_thread (void *(*thread_func) (qwaq_thread_t *), void *); #endif//__qwaq_h