projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
workqueue: make workqueue_exit() safe for multiple exit calls
[fio.git]
/
workqueue.c
diff --git
a/workqueue.c
b/workqueue.c
index 06fc26310dd57a829c4b05ce5bc00cd17856ab3f..5fd95b905aa8dff77090fcebdd7d1459a8b38067 100644
(file)
--- a/
workqueue.c
+++ b/
workqueue.c
@@
-234,6
+234,9
@@
void workqueue_exit(struct workqueue *wq)
struct submit_worker *sw;
int i;
struct submit_worker *sw;
int i;
+ if (!wq->workers)
+ return;
+
for (i = 0; i < wq->max_workers; i++) {
sw = &wq->workers[i];
for (i = 0; i < wq->max_workers; i++) {
sw = &wq->workers[i];
@@
-258,6
+261,7
@@
void workqueue_exit(struct workqueue *wq)
} while (shutdown && shutdown != wq->max_workers);
free(wq->workers);
} while (shutdown && shutdown != wq->max_workers);
free(wq->workers);
+ wq->workers = NULL;
pthread_mutex_destroy(&wq->flush_lock);
pthread_cond_destroy(&wq->flush_cond);
pthread_mutex_destroy(&wq->stat_lock);
pthread_mutex_destroy(&wq->flush_lock);
pthread_cond_destroy(&wq->flush_cond);
pthread_mutex_destroy(&wq->stat_lock);