summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-02-02 14:51:31 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-02-02 20:31:18 -0500
commitc1d630d5fd3c0b3307811d51f9840652e066a0f2 (patch)
treeb46a7f6b3cd7d8e0c71b86d14d05add2e72878d7 /src/shared
parent374c22b351e43ce4ef70ef0ad1bd1e4e520f9a28 (diff)
shared/async: simplify asynchronous_job a bit
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/async.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/shared/async.c b/src/shared/async.c
index 115901e637..7725e6d7d3 100644
--- a/src/shared/async.c
+++ b/src/shared/async.c
@@ -41,24 +41,18 @@ int asynchronous_job(void* (*func)(void *p), void *arg) {
* only in long running processes. */
r = pthread_attr_init(&a);
- if (r != 0)
+ if (r > 0)
return -r;
r = pthread_attr_setdetachstate(&a, PTHREAD_CREATE_DETACHED);
- if (r != 0) {
- r = -r;
+ if (r > 0)
goto finish;
- }
r = pthread_create(&t, &a, func, arg);
- if (r != 0) {
- r = -r;
- goto finish;
- }
finish:
pthread_attr_destroy(&a);
- return r;
+ return -r;
}
static void *sync_thread(void *p) {