[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gpsd-dev] [gpsd-commit-watch] [SCM] GPSD branch, master, updated. r
From: |
Eric S. Raymond |
Subject: |
Re: [gpsd-dev] [gpsd-commit-watch] [SCM] GPSD branch, master, updated. release-3.11-311-g7de7d97 |
Date: |
Sat, 31 Jan 2015 01:08:20 -0500 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Gary E. Miller <address@hidden>:
> Yo Eric!
>
> On Fri, 30 Jan 2015 16:41:27 -0500
> "Eric S. Raymond" <address@hidden> wrote:
>
> > Gary E. Miller <address@hidden>:
> > > You removed the assert()s I just added. The ones that start to show
> > > Hal's problem!
> >
> > Oh, those were debug aids! I apologize. By all means put them back
> > in under some kind of debugging guard.
>
> I changed it to this:
>
> void gpsd_acquire_reporting_lock(void)
> {
> int err;
> /*@ -unrecog (splint has no pthread declarations as yet) @*/
> err = pthread_mutex_lock(&report_mutex);
> /*@ +unrecog @*/
> if ( 0 != err ) {
> (void) fprintf(stderr,"pthread_mutex_lock() failed: %s\n",
> strerror(errno));
> exit(EXIT_FAILURE);
> }
> }
> void gpsd_release_reporting_lock(void)
> {
> int err;
> /*@ -unrecog (splint has no pthread declarations as yet) @*/
> err = pthread_mutex_unlock(&report_mutex);
> /*@ +unrecog @*/
> if ( 0 != err ) {
> (void) fprintf(stderr,"pthread_mutex_unlock() failed: %s\n",
> strerror(errno));
> exit(EXIT_FAILURE);
> }
> }
>
> I'm guessing you would like some comments. So how About this:
>
> /* POSIX says pthread_mutex_lock() should only fail if the thread
> holding the lock has died. Best to just die in that case. */
>
> /* POSIX says pthread_mutex_unlock() should only fail when trying to
> unlock a lock that does not exist, or is not owned by this thread.
> This should never happen, so best to die if that is the case. */
>
> Clear enough?
Yup.
--
<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>