Re: libpq thread-locking

From: Andrew Chernow <ac(at)esilo(dot)com>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: libpq thread-locking
Date: 2008-05-16 14:26:30
Message-ID: 482D9996.5000406@esilo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

! int
pthread_mutex_init(pthread_mutex_t *mp, void *attr)
{
*mp = CreateMutex(0, 0, 0);
+ if (*mp == NULL)
+ return 1;
+ return 0;
}

Maybe it would be better to emulate what pthreads does. Instead of
returing 1 to indicate an error, return an errno. In the above case,
ENOMEM seems like a good fit.

Also, maybe you should check the passed in mutex pointer. If its NULL,
you could return EINVAL.

--
Andrew Chernow
eSilo, LLC
every bit counts
http://www.esilo.com/

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Magnus Hagander 2008-05-16 14:35:20 Re: libpq thread-locking
Previous Message Magnus Hagander 2008-05-16 14:04:38 Re: libpq thread-locking