summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2009-01-05 19:07:13 +0100
committerJens Axboe <jens.axboe@oracle.com>2009-01-05 19:07:13 +0100
commitf42c153d303be537f2963b633013a0ae1ef4de65 (patch)
tree564175fd24528e0b427346f89e065fc8b22a25de
parent29adda3ce304f16036cafee6c099aa08444a7db1 (diff)
downloadfio-f42c153d303be537f2963b633013a0ae1ef4de65.tar.gz
Some more pthread_* call mishandled errors
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r--fio.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/fio.c b/fio.c
index 5a40004f..0ef039dd 100644
--- a/fio.c
+++ b/fio.c
@@ -1274,12 +1274,17 @@ static void *gtod_thread_main(void *data)
static int fio_start_gtod_thread(void)
{
- if (pthread_create(&gtod_thread, NULL, gtod_thread_main, NULL)) {
- perror("Can't create gtod thread");
+ int ret;
+
+ ret = pthread_create(&gtod_thread, NULL, gtod_thread_main, NULL);
+ if (ret) {
+ log_err("Can't create gtod thread: %s\n", strerror(ret));
return 1;
}
- if (pthread_detach(gtod_thread) < 0) {
- perror("Can't detatch gtod thread");
+
+ ret = pthread_detach(gtod_thread);
+ if (ret) {
+ log_err("Can't detatch gtod thread: %s\n", strerror(ret));
return 1;
}
@@ -1407,15 +1412,21 @@ static void run_threads(void)
nr_started++;
if (td->o.use_thread) {
+ int ret;
+
dprint(FD_PROCESS, "will pthread_create\n");
- if (pthread_create(&td->thread, NULL,
- thread_main, td)) {
- perror("pthread_create");
+ ret = pthread_create(&td->thread, NULL,
+ thread_main, td);
+ if (ret) {
+ log_err("pthread_create: %s\n",
+ strerror(ret));
nr_started--;
break;
}
- if (pthread_detach(td->thread) < 0)
- perror("pthread_detach");
+ ret = pthread_detach(td->thread);
+ if (ret)
+ log_err("pthread_detach: %s",
+ strerror(ret));
} else {
pid_t pid;
dprint(FD_PROCESS, "will fork\n");