diff options
Diffstat (limited to 'unix/tclUnixThrd.c')
-rw-r--r-- | unix/tclUnixThrd.c | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c index 2e8e8a4..bbbb3f2 100644 --- a/unix/tclUnixThrd.c +++ b/unix/tclUnixThrd.c @@ -53,8 +53,6 @@ static pthread_mutex_t *allocLockPtr = &allocLock; #endif /* TCL_THREADS */ - - /* *---------------------------------------------------------------------- * @@ -133,6 +131,40 @@ Tcl_CreateThread(idPtr, proc, clientData, stackSize, flags) #endif /* TCL_THREADS */ } +/* + *---------------------------------------------------------------------- + * + * Tcl_JoinThread -- + * + * This procedure waits upon the exit of the specified thread. + * + * Results: + * TCL_OK if the wait was successful, TCL_ERROR else. + * + * Side effects: + * The result area is set to the exit code of the thread we + * waited upon. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_JoinThread(id, state) + Tcl_ThreadId id; /* Id of the thread to wait upon */ + int* state; /* Reference to the storage the result + * of the thread we wait upon will be + * written into. */ +{ +#ifdef TCL_THREADS + int result; + + result = pthread_join ((pthread_t) id, (VOID**) state); + return (result == 0) ? TCL_OK : TCL_ERROR; +#else + return TCL_ERROR; +#endif +} + #ifdef TCL_THREADS /* *---------------------------------------------------------------------- |