From cfe666a2f39fdf5b30c7eb22341a529ae57276e4 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 2 Oct 2010 17:16:27 -0400 Subject: Error out if an error occurs in a raytracing worker thread. --- libdimension/raytrace.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'libdimension') diff --git a/libdimension/raytrace.c b/libdimension/raytrace.c index 396c8b4..98f941b 100644 --- a/libdimension/raytrace.c +++ b/libdimension/raytrace.c @@ -118,10 +118,17 @@ dmnsn_raytrace_scene_thread(void *ptr) } for (int i = 0; i < nthreads; ++i) { - if (pthread_join(threads[i], NULL)) { + void *ptr = NULL; + if (pthread_join(threads[i], &ptr)) { dmnsn_error(DMNSN_SEVERITY_MEDIUM, "Couldn't join worker thread in raytrace engine."); } + if (ptr) { + int retval = *(int *)ptr; + dmnsn_free(ptr); + if (retval != 0) + dmnsn_error(DMNSN_SEVERITY_HIGH, "Error occurred in worker thread."); + } } dmnsn_complete_timer(payload->scene->render_timer); -- cgit v1.2.3