projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
stat: avoid hang with race in stat thread exit and rusage update
[fio.git]
/
idletime.c
diff --git
a/idletime.c
b/idletime.c
index bc8097680d69f37b139495b61f56287b588c9693..a366d2b16311bf6ec1b8e8d50fb84c44edc71eda 100644
(file)
--- a/
idletime.c
+++ b/
idletime.c
@@
-73,8
+73,10
@@
static void *idle_prof_thread_fn(void *data)
pthread_mutex_lock(&ipt->init_lock);
/* exit if any other thread failed to start */
pthread_mutex_lock(&ipt->init_lock);
/* exit if any other thread failed to start */
- if (ipc.status == IDLE_PROF_STATUS_ABORT)
+ if (ipc.status == IDLE_PROF_STATUS_ABORT) {
+ pthread_mutex_unlock(&ipt->init_lock);
return NULL;
return NULL;
+ }
retval = set_cpu_affinity(ipt);
if (retval == -1) {
retval = set_cpu_affinity(ipt);
if (retval == -1) {
@@
-109,12
+111,16
@@
static void *idle_prof_thread_fn(void *data)
pthread_mutex_lock(&ipt->start_lock);
/* exit if other threads failed to initialize */
pthread_mutex_lock(&ipt->start_lock);
/* exit if other threads failed to initialize */
- if (ipc.status == IDLE_PROF_STATUS_ABORT)
+ if (ipc.status == IDLE_PROF_STATUS_ABORT) {
+ pthread_mutex_unlock(&ipt->start_lock);
return NULL;
return NULL;
+ }
/* exit if we are doing calibration only */
/* exit if we are doing calibration only */
- if (ipc.status == IDLE_PROF_STATUS_CALI_STOP)
+ if (ipc.status == IDLE_PROF_STATUS_CALI_STOP) {
+ pthread_mutex_unlock(&ipt->start_lock);
return NULL;
return NULL;
+ }
fio_gettime(&ipt->tps, NULL);
ipt->state = TD_RUNNING;
fio_gettime(&ipt->tps, NULL);
ipt->state = TD_RUNNING;