diff options
author | Gary E. Miller <gem@rellim.com> | 2015-01-29 12:32:52 -0800 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2015-01-29 12:32:52 -0800 |
commit | 130006665c2559c50b5c99eb3ffdfb2f0ab22ae8 (patch) | |
tree | 05caed92055eaf2edc7efb2728402d1ec130fa48 | |
parent | ee40d6733bcd312576c9223de6adaf16f1e0cfd2 (diff) | |
download | gpsd-130006665c2559c50b5c99eb3ffdfb2f0ab22ae8.tar.gz |
Add assert()s to the mutex lock/unlock.
When in doubt, always test return codes.
-rw-r--r-- | libgpsd_core.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libgpsd_core.c b/libgpsd_core.c index 5da839e7..08f4cd4e 100644 --- a/libgpsd_core.c +++ b/libgpsd_core.c @@ -62,16 +62,20 @@ static pthread_mutex_t report_mutex; void gpsd_acquire_reporting_lock(void) { + int err; /*@ -unrecog (splint has no pthread declarations as yet) @*/ - (void)pthread_mutex_lock(&report_mutex); + err = pthread_mutex_lock(&report_mutex); /*@ +unrecog @*/ + assert( 0 != err); } void gpsd_release_reporting_lock(void) { + int err; /*@ -unrecog (splint has no pthread declarations as yet) @*/ - (void)pthread_mutex_unlock(&report_mutex); + err = pthread_mutex_unlock(&report_mutex); /*@ +unrecog @*/ + assert( 0 != err); } #endif /* PPS_ENABLE */ |