Re: PIKE_MODULE_INIT/EXIT in a normal pgsql.pike file

Arne Goedeke <[email protected]>
Newsgroups gmane.comp.lang.pike.user
Message-ID <[email protected]>
I might be misunderstanding the situation here, so correct me if I talk
nonsense. If you have a pike pmod, just use that to store your "global"
backend.

However, this is such a common technique in pike (due to the lack of
static variables), that it can't be what you are asking for...

arne

On 10/22/14 15:39, Stephen R. van den Berg wrote:
> Stephen R. van den Berg wrote:
>> However, in order to get this flying I basically need to run
>> a separate pgsql backend.  Currently I simply start up a new one in a separate
>> thread for every connection to the database.
>> But, these could be shared by all pgsql connections.
> 
>> So, is there some kind of PIKE_MODULE_INIT/EXIT or C-static equivalent
>> which I could use to make sure that I only create at most one thread
>> for this?
> 
> Despite the overwhelming response to this question, I tried to investigate
> on my own, and basically I came up with (drumroll):
> 
> 	getenv()/putenv()
> 
> It's ugly, but it seems to be the only way to have some kind of global
> state over which different threads can meet and sync up.
> However, I'd need a way to serialise a reference to an object (a shared
> backend, to be precise).
> 
> Any ideas?
> Or can we have some kind of Master.get() and Master.set() equivalent
> to the Thread.Local set which would fill this gap?
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.