msec_to_next_event = DISK_UTIL_MSEC;
if (since_du >= DISK_UTIL_MSEC)
msec_to_next_event -= (since_du - DISK_UTIL_MSEC);
- } else {
- if (since_du >= DISK_UTIL_MSEC)
- msec_to_next_event = DISK_UTIL_MSEC - (DISK_UTIL_MSEC - since_du);
- else
- msec_to_next_event = DISK_UTIL_MSEC;
- }
+ } else
+ msec_to_next_event = DISK_UTIL_MSEC - since_du;
if (hd->do_stat) {
hd->do_stat = 0;
setup_disk_util();
hd->sk_out = sk_out;
- pthread_cond_init(&hd->cond, NULL);
- pthread_mutex_init(&hd->lock, NULL);
+
+ ret = mutex_cond_init_pshared(&hd->lock, &hd->cond);
+ if (ret)
+ return 1;
+
hd->startup_mutex = startup_mutex;
ret = pthread_create(&hd->thread, NULL, helper_thread_main, hd);