Re: New shared memory hooks proposal (was Re: pre_load_libraries)
От | Marc Munro |
---|---|
Тема | Re: New shared memory hooks proposal (was Re: pre_load_libraries) |
Дата | |
Msg-id | 1153265764.16766.48.camel@bloodnok.com обсуждение исходный текст |
Ответы |
Re: New shared memory hooks proposal (was Re:
Re: New shared memory hooks proposal (was Re: |
Список | pgsql-patches |
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
Вложения
В списке pgsql-patches по дате отправления: