gpsd-dev
[Top][All Lists]
Advanced

[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: Gary E. Miller
Subject: Re: [gpsd-dev] [gpsd-commit-watch] [SCM] GPSD branch, master, updated. release-3.11-311-g7de7d97
Date: Fri, 30 Jan 2015 15:10:55 -0800

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?

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97701
        address@hidden  Tel:+1(541)382-8588



reply via email to

[Prev in Thread] Current Thread [Next in Thread]