Mercurial > hg > octave-lyh > gnulib-hg
changeset 10330:f4a133133dce
Make gl_create_thread easier to use.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 17 Aug 2008 21:18:02 +0200 |
parents | b4b925d625c0 |
children | d10548c1dd8b |
files | lib/glthread/thread.h |
diffstat | 1 files changed, 7 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/glthread/thread.h +++ b/lib/glthread/thread.h @@ -24,7 +24,7 @@ Thread data type: gl_thread_t. Creating a thread: - gl_thread_create (thread, func, arg); + thread = gl_thread_create (func, arg); Or with control of error handling: err = glthread_create (&thread, func, arg); extern int glthread_create (gl_thread_t *result, @@ -260,7 +260,7 @@ /* Provide dummy implementation if threads are not supported. */ typedef int gl_thread_t; -# define glthread_create(THREADP, FUNC, ARG) 0 +# define glthread_create(THREADP, FUNC, ARG) ENOSYS # define glthread_sigmask(HOW, SET, OSET) 0 # define glthread_join(THREAD, RETVALP) 0 # define gl_thread_self() NULL @@ -274,20 +274,17 @@ /* Macros with built-in error handling. */ -static inline int -gl_thread_create_func (gl_thread_t * thread, - void *(*func) (void *arg), - void *arg) +static inline gl_thread_t +gl_thread_create (void *(*func) (void *arg), void *arg) { + gl_thread_t thread; int ret; - ret = glthread_create (thread, func, arg); + ret = glthread_create (&thread, func, arg); if (ret != 0) abort (); - return ret; + return thread; } -#define gl_thread_create(THREAD, FUNC, ARG) \ - gl_thread_create_func (&THREAD, FUNC, ARG) #define gl_thread_sigmask(HOW, SET, OSET) \ do \ { \