diff options
Diffstat (limited to 'libglusterfs/src/common-utils.c')
-rw-r--r-- | libglusterfs/src/common-utils.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 751dc8a2e50..1adfdaa1673 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -3245,6 +3245,29 @@ gf_set_log_ident (cmd_args_t *cmd_args) } int +gf_thread_cleanup_xint (pthread_t thread) +{ + int ret = 0; + void *res = NULL; + + ret = pthread_cancel (thread); + if (ret != 0) + goto error_return; + + ret = pthread_join (thread, &res); + if (ret != 0) + goto error_return; + + if (res != PTHREAD_CANCELED) + goto error_return; + + ret = 0; + + error_return: + return ret; +} + +int gf_thread_create (pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg) { |