Re: What happens if I create new threads from within a postgresql function? - Mailing list pgsql-general

From Bruce Momjian
Subject Re: What happens if I create new threads from within a postgresql function?
Date
Msg-id 20130218180942.GA18255@momjian.us
Whole thread Raw
In response to Re: What happens if I create new threads from within a postgresql function?  (Atri Sharma <atri.jiit@gmail.com>)
Responses Re: What happens if I create new threads from within a postgresql function?  (Atri Sharma <atri.jiit@gmail.com>)
List pgsql-general
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 waiting
> >>>> queue in my code?
> >>>
> >>> Is this from the client code?  That is easy from libpq using
> >>> asynchronous queries.
> >>>
> >>>
> >>
> >> Actually, I haven't yet faced any such scenario.I was just thinking of all the possibilities that can happen in
thiscase.Hehehe 
> >>
> >> If we want to do this from a function in PostgreSQL itself, would a local synchronisation mechanism work?
> >
> > 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.
> >
> >
>
> Got that,thanks a ton!
>
> I will see the dblink code.
>
> BTW, is there no way to introduce a general synchronisation mechanism for server side code? A kind of construct which
wouldbe the standard way to manage synchronisation ? I was thinking of something on the lines of a monitor. 

You would use the standard methods, semaphores for processes, thread
locks for threads.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +

pgsql-general by date:

Previous
From: Atri Sharma
Date:
Subject: Re: What happens if I create new threads from within a postgresql function?
Next
From: Atri Sharma
Date:
Subject: Re: What happens if I create new threads from within a postgresql function?