Sent from my iPad
On 18-Feb-2013, at 23:39, Bruce Momjian <bruce@momjian.us> wrote:
> On Mon, Feb 18, 2013 at 11:25:44PM +0530, Atri Sharma wrote:
>>>>>> Is there any way to locally synchronise the threads in my code,and
>>>>>> send the requests to the PostgreSQL backend one at a time? Like a wai=
ting
>>>>>> queue in my code?
>>>>>=20
>>>>> Is this from the client code? That is easy from libpq using
>>>>> asynchronous queries.
>>>>>=20
>>>>>=20
>>>>=20
>>>> Actually, I haven't yet faced any such scenario.I was just thinking of a=
ll the possibilities that can happen in this case.Hehehe
>>>>=20
>>>> If we want to do this from a function in PostgreSQL itself, would a loc=
al synchronisation mechanism work?
>>>=20
>>> So your server-side function wants to start a new backend --- yeah, that=
>>> works. /contrib/dblink does exactly that. Calling it from threads
>>> should have the same limitations you would normally have from libpq.
>>>=20
>>>=20
>>=20
>> Got that,thanks a ton!
>>=20
>> I will see the dblink code.
>>=20
>> BTW, is there no way to introduce a general synchronisation mechanism for=
server side code? A kind of construct which would be the standard way to ma=
nage synchronisation ? I was thinking of something on the lines of a monitor=
.
>=20
> You would use the standard methods, semaphores for processes, thread
> locks for threads.
>=20
I will try it out.Thanks a ton!
Regards,
Atri=