summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libdimension-python/dimension.pyx7
-rw-r--r--libdimension/threads.c2
2 files changed, 8 insertions, 1 deletions
diff --git a/libdimension-python/dimension.pyx b/libdimension-python/dimension.pyx
index cc8efdb..dd91b0e 100644
--- a/libdimension-python/dimension.pyx
+++ b/libdimension-python/dimension.pyx
@@ -272,7 +272,7 @@ cdef class Matrix:
cpdef Matrix inverse(self):
"""Return the inverse of a matrix."""
- return _Matrix(dmnsn_matrix_inverse(self._m));
+ return _Matrix(dmnsn_matrix_inverse(self._m))
def __repr__(self):
return \
@@ -1404,6 +1404,8 @@ cdef class Scene:
def __get__(self):
return self._scene.nthreads
def __set__(self, n):
+ if n <= 0:
+ raise ValueError("%d is an invalid thread count." % n)
self._scene.nthreads = n
property quality:
@@ -1464,6 +1466,9 @@ def _string_to_quality(str quality not None):
cdef int q = DMNSN_RENDER_NONE
inverse = False
+ if quality == "":
+ return q
+
if quality[0] == '^':
inverse = True
quality = quality[1:]
diff --git a/libdimension/threads.c b/libdimension/threads.c
index 54939e6..04874de 100644
--- a/libdimension/threads.c
+++ b/libdimension/threads.c
@@ -93,6 +93,8 @@ int
dmnsn_execute_concurrently(dmnsn_ccthread_fn *ccthread_fn,
void *arg, unsigned int nthreads)
{
+ dmnsn_assert(nthreads > 0, "Attempt to execute using 0 concurrent threads.");
+
pthread_t threads[nthreads];
dmnsn_ccthread_payload payloads[nthreads];