summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libdimension/png.c12
-rw-r--r--libdimension/raytrace.c6
-rw-r--r--libdimension/threads.c6
-rw-r--r--libdimension/threads.h4
4 files changed, 9 insertions, 19 deletions
diff --git a/libdimension/png.c b/libdimension/png.c
index 189c998..ed98210 100644
--- a/libdimension/png.c
+++ b/libdimension/png.c
@@ -140,11 +140,7 @@ dmnsn_png_write_canvas_async(const dmnsn_canvas *canvas, FILE *file)
payload->file = file;
/* Create the worker thread */
- if (dmnsn_new_thread(progress, NULL, &dmnsn_png_write_canvas_thread, payload)
- != 0)
- {
- dmnsn_error(DMNSN_SEVERITY_HIGH, "Couldn't start worker thread.");
- }
+ dmnsn_new_thread(progress, NULL, &dmnsn_png_write_canvas_thread, payload);
return progress;
}
@@ -172,11 +168,7 @@ dmnsn_png_read_canvas_async(dmnsn_canvas **canvas, FILE *file)
payload->file = file;
/* Create the worker thread */
- if (dmnsn_new_thread(progress, NULL, &dmnsn_png_read_canvas_thread, payload)
- != 0)
- {
- dmnsn_error(DMNSN_SEVERITY_HIGH, "Couldn't start worker thread.");
- }
+ dmnsn_new_thread(progress, NULL, &dmnsn_png_read_canvas_thread, payload);
return progress;
}
diff --git a/libdimension/raytrace.c b/libdimension/raytrace.c
index 9822c8c..396c8b4 100644
--- a/libdimension/raytrace.c
+++ b/libdimension/raytrace.c
@@ -58,11 +58,7 @@ dmnsn_raytrace_scene_async(dmnsn_scene *scene)
payload->progress = progress;
payload->scene = scene;
- if (dmnsn_new_thread(progress, NULL, &dmnsn_raytrace_scene_thread, payload)
- != 0)
- {
- dmnsn_error(DMNSN_SEVERITY_HIGH, "Couldn't start worker thread.");
- }
+ dmnsn_new_thread(progress, NULL, &dmnsn_raytrace_scene_thread, payload);
return progress;
}
diff --git a/libdimension/threads.c b/libdimension/threads.c
index 22a5b9a..1f1acd5 100644
--- a/libdimension/threads.c
+++ b/libdimension/threads.c
@@ -46,7 +46,7 @@ dmnsn_thread(void *arg)
return ret;
}
-int
+void
dmnsn_new_thread(dmnsn_progress *progress, const pthread_attr_t *attr,
dmnsn_thread_fn *thread_fn, void *arg)
{
@@ -55,5 +55,7 @@ dmnsn_new_thread(dmnsn_progress *progress, const pthread_attr_t *attr,
payload->arg = arg;
payload->progress = progress;
- return pthread_create(&progress->thread, attr, &dmnsn_thread, payload);
+ if (pthread_create(&progress->thread, attr, &dmnsn_thread, payload) != 0) {
+ dmnsn_error(DMNSN_SEVERITY_HIGH, "Couldn't start thread.");
+ }
}
diff --git a/libdimension/threads.h b/libdimension/threads.h
index 5884fae..00be0a9 100644
--- a/libdimension/threads.h
+++ b/libdimension/threads.h
@@ -26,7 +26,7 @@
typedef int dmnsn_thread_fn(void *ptr);
/* Creates a thread that cleans up after itself on errors */
-int dmnsn_new_thread(dmnsn_progress *progress, const pthread_attr_t *attr,
- dmnsn_thread_fn *thread_fn, void *arg);
+void dmnsn_new_thread(dmnsn_progress *progress, const pthread_attr_t *attr,
+ dmnsn_thread_fn *thread_fn, void *arg);
#endif /* DIMENSION_IMPL_THREADS_H */