| From: | Alan Nilsson <anilsson(at)apple(dot)com> |
|---|---|
| To: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
| Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: shared memory allocation - C function |
| Date: | 2014-04-17 19:11:11 |
| Message-ID: | 27705E15-CBCF-4FC4-8FA0-64EDB37DBA2B@apple.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Perfect, thank you.
On Apr 16, 2014, at 9:56 PM, Michael Paquier <michael(dot)paquier(at)gmail(dot)com> wrote:
> On Thu, Apr 17, 2014 at 8:04 AM, Alan Nilsson <anilsson(at)apple(dot)com> wrote:
> Is it possible to allocate a small chunk of shared memory outside of any pools(i.e. manually alloced & de-alloced) that is visible to all processes? I would like a small amount to store a mutex and a condition variable that is accessible in a c function from any process. Is there an SPI/API to do this?
> You can allocate a custom amount of shared memory at server initialization using the hook called shmem_startup_hook in ipci.c through a library loaded with shared_preload_libraries. Why not having a look at contrib/pg_stat_statements which is a good example?
> --
> Michael
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Guillaume Drolet | 2014-04-17 20:29:40 | Cluster recovery - FATAL: database files are incompatible with server. Different PG_CONTROL_VERSION for cluster and server. |
| Previous Message | Joseph Kregloh | 2014-04-17 18:45:59 | Re: pg_upgrade & tablespaces |