int ret;
pid_t pid;
+ DBG("Spawning kconsumerd");
+
pid = fork();
if (pid == 0) {
/*
{
int ret;
- DBG("Spawning kconsumerd");
-
pthread_mutex_lock(&kconsumerd_pid_mutex);
- if (kconsumerd_pid == 0) {
- ret = spawn_kconsumerd();
- if (ret < 0) {
- ERR("Spawning kconsumerd failed");
- ret = LTTCOMM_KERN_CONSUMER_FAIL;
- pthread_mutex_unlock(&kconsumerd_pid_mutex);
- goto error;
- }
+ if (kconsumerd_pid != 0) {
+ goto end;
+ }
- /* Setting up the global kconsumerd_pid */
- kconsumerd_pid = ret;
+ ret = spawn_kconsumerd();
+ if (ret < 0) {
+ ERR("Spawning kconsumerd failed");
+ ret = LTTCOMM_KERN_CONSUMER_FAIL;
+ pthread_mutex_unlock(&kconsumerd_pid_mutex);
+ goto error;
}
+
+ /* Setting up the global kconsumerd_pid */
+ kconsumerd_pid = ret;
pthread_mutex_unlock(&kconsumerd_pid_mutex);
DBG("Kconsumerd pid %d", ret);
goto error;
}
+end:
+ pthread_mutex_unlock(&kconsumerd_pid_mutex);
return 0;
error: