]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
document isc__trampoline
authorEvan Hunt <each@isc.org>
Fri, 28 May 2021 20:47:59 +0000 (13:47 -0700)
committerEvan Hunt <each@isc.org>
Wed, 14 Jul 2021 17:55:12 +0000 (10:55 -0700)
Added some header file documentation to the isc__trampoline
implementation in trampoline_p.h.

lib/isc/trampoline_p.h

index 12bc6ad0e71567a8f8e3ed85e9ed98a122c383b4..910fdd34bd91536c1d0b20b44279496a68a3e7fc 100644 (file)
 
 #include <isc/thread.h>
 
+/*! \file isc/trampoline_p.h
+ * \brief isc__trampoline: allows safe reuse of thread ID numbers.
+ *
+ * The 'isc_hp' hazard pointer API uses an internal thread ID
+ * variable ('tid_v') that is incremented for each new thread that uses
+ * hazard pointers. This thread ID is then used as an index into a global
+ * shared table of hazard pointer state.
+ *
+ * Since the thread ID is only incremented and never decremented, the
+ * table can overflow if threads are frequently created and destroyed.
+ *
+ * A trampoline is a thin wrapper around any function to be called from
+ * a newly launched thread. It maintains a table of thread IDs used by
+ * current and previous threads; when a thread is destroyed, its slot in
+ * the trampoline table becomes available, and the next thread to occupy
+ * that slot can use the same thread ID that its predecessor did.
+ *
+ * The trampoline table initially has space for 64 worker threads in
+ * addition to the main thread. if more threads than that in concurrent
+ * concurrently, the table is reallocated with twice as much space.
+ * (Note that the number of concurrent threads is currently capped at
+ * 128 by the queue and hazard pointer implementations.)
+ */
+
 typedef struct isc__trampoline isc__trampoline_t;
 
 void