Module: xenomai-forge Branch: master Commit: 5360cf746eaa400d76bcabd48222aad8d3781eea URL: http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=5360cf746eaa400d76bcabd48222aad8d3781eea
Author: Philippe Gerum <r...@xenomai.org> Date: Tue Nov 29 09:18:42 2011 +0100 copperplate/syncobj: catch unlocked calls to blocking services --- lib/copperplate/syncobj.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/lib/copperplate/syncobj.c b/lib/copperplate/syncobj.c index f099d6a..92bc1f4 100644 --- a/lib/copperplate/syncobj.c +++ b/lib/copperplate/syncobj.c @@ -236,6 +236,12 @@ int syncobj_pend(struct syncobj *sobj, const struct timespec *timeout, * cancelability before pending on the condvar. */ pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &state); + /* + * Catch spurious unlocked calls: this must be a blatant bug + * in the calling code, don't even try to continue + * (syncobj_lock() required first). + */ + assert(state == PTHREAD_CANCEL_DISABLE); do { if (timeout) @@ -335,6 +341,7 @@ int syncobj_wait_drain(struct syncobj *sobj, const struct timespec *timeout, sobj->drain_count++; pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &state); + assert(state == PTHREAD_CANCEL_DISABLE); if (current->wait_hook) current->wait_hook(current, SYNCOBJ_BLOCK); _______________________________________________ Xenomai-git mailing list Xenomai-git@gna.org https://mail.gna.org/listinfo/xenomai-git