diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2013-07-24 17:41:55 -0400 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2013-07-24 17:42:34 -0400 |
| commit | fa2fad3c06bfde03594ff38d53acdf9a60c56bb2 (patch) | |
| tree | b671f9592a010f3ba86d263d6a6d666940f54bcf /src/include/postmaster | |
| parent | 910d3a458c15c1b4cc518ba480be2f712f42f179 (diff) | |
| download | postgresql-fa2fad3c06bfde03594ff38d53acdf9a60c56bb2.tar.gz | |
Improve ilist.h's support for deletion of slist elements during iteration.
Previously one had to use slist_delete(), implying an additional scan of
the list, making this infrastructure considerably less efficient than
traditional Lists when deletion of element(s) in a long list is needed.
Modify the slist_foreach_modify() macro to support deleting the current
element in O(1) time, by keeping a "prev" pointer in addition to "cur"
and "next". Although this makes iteration with this macro a bit slower,
no real harm is done, since in any scenario where you're not going to
delete the current list element you might as well just use slist_foreach
instead. Improve the comments about when to use each macro.
Back-patch to 9.3 so that we'll have consistent semantics in all branches
that provide ilist.h. Note this is an ABI break for callers of
slist_foreach_modify().
Andres Freund and Tom Lane
Diffstat (limited to 'src/include/postmaster')
| -rw-r--r-- | src/include/postmaster/bgworker_internals.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/include/postmaster/bgworker_internals.h b/src/include/postmaster/bgworker_internals.h index 6484cfb7a6..478a1fff0d 100644 --- a/src/include/postmaster/bgworker_internals.h +++ b/src/include/postmaster/bgworker_internals.h @@ -39,7 +39,7 @@ extern slist_head BackgroundWorkerList; extern Size BackgroundWorkerShmemSize(void); extern void BackgroundWorkerShmemInit(void); extern void BackgroundWorkerStateChange(void); -extern void ForgetBackgroundWorker(RegisteredBgWorker *); +extern void ForgetBackgroundWorker(slist_mutable_iter *cur); #ifdef EXEC_BACKEND extern BackgroundWorker *BackgroundWorkerEntry(int slotno); |
