Re: Plugins redux (was Re: [PATCHES] PL instrumentation

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: korryd(at)enterprisedb(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Plugins redux (was Re: [PATCHES] PL instrumentation
Date: 2006-08-09 18:17:38
Message-ID: 1155147458.12968.147.camel@dogma.v10.wvs
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On Wed, 2006-08-09 at 12:44 -0400, Tom Lane wrote:
> A plugin such as a plpgsql debugger would do this in its _PG_init()
> function:
>
> static PLpgSQL_plugin my_plugin = { ... function addresses ... };
>
> PLpgSQL_plugin **var_ptr;
>
> var_ptr = (PLpgSQL_plugin **) find_rendezvous_variable("PLpgSQL_plugin");
> *var_ptr = &my_plugin;
>
> and this in its _PG_fini() function:
>
> PLpgSQL_plugin **var_ptr;
>
> var_ptr = (PLpgSQL_plugin **) find_rendezvous_variable("PLpgSQL_plugin");
> *var_ptr = NULL;
>
> Meanwhile, plpgsql itself would do this in its _PG_init() function:
>
> static PLpgSQL_plugin **plugin_ptr = NULL;
>
> plugin_ptr = (PLpgSQL_plugin **) find_rendezvous_variable("PLpgSQL_plugin");
>
> and in the places where it wants to pass control to the plugin, it'd do
>
> if (*plugin_ptr)
> ((*plugin_ptr)->function_field) (... args ...);
>

I know this is a trivial question, but is there some kind of lock that
would prevent the PG_fini for the plpgsql debugger from executing after
"if(*plugin_ptr)" and before "((*plugin_ptr)->function_field)(...)"?

Regards,
Jeff Davis

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-08-09 18:27:33 Re: Plugins redux (was Re: [PATCHES] PL instrumentation plugin support)
Previous Message Joshua D. Drake 2006-08-09 18:04:55 Re: 8.2 features status

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2006-08-09 18:27:33 Re: Plugins redux (was Re: [PATCHES] PL instrumentation plugin support)
Previous Message Bruce Momjian 2006-08-09 17:58:58 Re: BUG #2569: statement_timeout bug on Windows