Add a sanity assertion.

This commit is contained in:
Ian Gulliver
2015-07-06 01:43:56 +00:00
parent 34154d3939
commit d52d5df148

View File

@@ -31,6 +31,7 @@ promise *promise_create(promise_callback on_success, promise_callback on_failure
} }
void promise_destroy(promise *promise_obj) { void promise_destroy(promise *promise_obj) {
assert(promise_obj->fulfilled);
assert(!pthread_mutex_destroy(&promise_obj->lock)); assert(!pthread_mutex_destroy(&promise_obj->lock));
assert(!pthread_cond_destroy(&promise_obj->cond)); assert(!pthread_cond_destroy(&promise_obj->cond));
if (promise_obj->result && promise_obj->cleanup) { if (promise_obj->result && promise_obj->cleanup) {