Skip site navigation (1) Skip section navigation (2)

Re: libpq thread-locking

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Andrew Chernow <ac(at)esilo(dot)com>
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:35:20
Message-ID: 20080516163520.03248ec0@mha-laptop.hagander.net (view raw or flat)
Thread:
Lists: pgsql-patches
Andrew Chernow wrote:
> ! 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.

Given that we only call this stuff internally, I don't think it's a big
issue. But either way - that part of the code will be replaced with the
critical_section code later anyway - I just want to get the "generic"
changes through first.

//Magnus

In response to

pgsql-patches by date

Next:From: Tom LaneDate: 2008-05-16 14:59:08
Subject: Re: libpq object hooks
Previous:From: Andrew ChernowDate: 2008-05-16 14:26:30
Subject: Re: libpq thread-locking

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group