summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/common-utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src/common-utils.c')
-rw-r--r--libglusterfs/src/common-utils.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index 337d5ed00fc..7669b6b4ca3 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -3357,6 +3357,36 @@ gf_thread_create (pthread_t *thread, const pthread_attr_t *attr,
}
int
+gf_thread_create_detached (pthread_t *thread,
+ void *(*start_routine)(void *), void *arg)
+{
+ pthread_attr_t attr;
+ int ret = -1;
+
+ ret = pthread_attr_init (&attr);
+ if (ret) {
+ gf_msg (THIS->name, GF_LOG_ERROR, ret,
+ LG_MSG_PTHREAD_ATTR_INIT_FAILED,
+ "Thread attribute initialization failed");
+ return -1;
+ }
+
+ pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
+
+ ret = gf_thread_create (thread, &attr, start_routine, arg);
+ if (ret) {
+ gf_msg (THIS->name, GF_LOG_ERROR, ret,
+ LG_MSG_PTHREAD_FAILED,
+ "Thread creation failed");
+ ret = -1;
+ }
+
+ pthread_attr_destroy (&attr);
+
+ return ret;
+}
+
+int
gf_skip_header_section (int fd, int header_len)
{
int ret = -1;