Re: New shared memory hooks proposal (was Re:

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Marc Munro <marc(at)bloodnok(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: New shared memory hooks proposal (was Re:
Date: 2006-08-01 19:04:25
Message-ID: 200608011904.k71J4P312093@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches


I updated the style of your patch, and added a little to your comment
block about how to use this capability. I don't think any additional
documentation is necessary.

Thanks.

---------------------------------------------------------------------------

Marc Munro wrote:
-- Start of PGP signed section.
> The attached patch provides add-ins with the means to register for
> shared memory and LWLocks. This greatly improves the ease with which
> shared memory may be used from add-ins, while keeping the accounting and
> management for that shared memory separate.
>
> Specifically it adds named add-in shared memory contexts. From these,
> memory can be allocated without affecting the memory available in other
> contexts.
>
> Usage is as follows:
> from add-in functions called from preload_libraries, you may call
> RegisterAddinContext(const * name, size_t size)
> to register a new (logical) shared memory segment.
>
> and
> RegisterAddinLWLock(LWLockid *lock_ptr);
> to request that a LWLock be allocated, placed into *lock_ptr.
>
> The actual creation of the shared memory segment and lwlocks is
> performed later as part of shared memory initialisation.
>
> To allocate shared memory from a named context you would use
> ShmemAllocFromContext(size_t size, const char *name);
>
> To reset a shared memory context back to its original unused state (from
> which new allocations may be performed), you may use
> ShmemResetContext(const char *name);
>
> This works for me (for Veil) and make check runs fine.
>
> I have not included any documentation updates in the patch as I'm not
> sure where such API changes should be documented.
>
> All comments, questions and suggestions are welcomed.
>
> __
> Marc

[ Attachment, skipping... ]
-- End of PGP section, PGP failed!

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

Attachment Content-Type Size
/rtmp/diff text/x-diff 12.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Chris Browne 2006-08-01 20:05:06 Replication Documentation
Previous Message Andrew Dunstan 2006-08-01 18:31:34 Re: better support of out parameters in plperl

Browse pgsql-patches by date

  From Date Subject
Next Message Chris Browne 2006-08-01 20:05:06 Replication Documentation
Previous Message Andrew Dunstan 2006-08-01 18:31:34 Re: better support of out parameters in plperl