aboutsummaryrefslogtreecommitdiff
path: root/src/core/mainloop
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-12-02 11:41:40 -0500
committerNick Mathewson <nickm@torproject.org>2019-12-02 11:41:40 -0500
commitf63cf2158b22b891a596a1274d1076faf3b69a27 (patch)
tree7ee9366bce4b44d2bc903af7c2c7094c986059d7 /src/core/mainloop
parent53bdd21179b3507b8d8aa2788e4955df8619f6db (diff)
parentaf7416bfad1107a43cafef978674f051f2f5584f (diff)
downloadtor-f63cf2158b22b891a596a1274d1076faf3b69a27.tar.gz
tor-f63cf2158b22b891a596a1274d1076faf3b69a27.zip
Merge branch 'ticket32207'
Diffstat (limited to 'src/core/mainloop')
-rw-r--r--src/core/mainloop/mainloop_pubsub.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/core/mainloop/mainloop_pubsub.h b/src/core/mainloop/mainloop_pubsub.h
index bd57c0c174..c02127401e 100644
--- a/src/core/mainloop/mainloop_pubsub.h
+++ b/src/core/mainloop/mainloop_pubsub.h
@@ -14,9 +14,41 @@
struct pubsub_builder_t;
+/**
+ * Describe when and how messages are delivered on message channel.
+ *
+ * Every message channel must be associated with one of these strategies.
+ **/
typedef enum {
+ /**
+ * Never deliver messages automatically.
+ *
+ * If a message channel uses this strategy, then no matter now many
+ * messages are published on it, they are not delivered until something
+ * manually calls dispatch_flush() for that channel
+ **/
DELIV_NEVER=0,
+ /**
+ * Deliver messages promptly, via the event loop.
+ *
+ * If a message channel uses this strategy, then publishing a messages
+ * that channel activates an event that causes messages to be handled
+ * later in the mainloop. The messages will be processed at some point
+ * very soon, delaying only for pending IO events and the like.
+ *
+ * Generally this is the best choice for a delivery strategy, since
+ * it avoids stack explosion.
+ **/
DELIV_PROMPT,
+ /**
+ * Deliver messages immediately, skipping the event loop.
+ *
+ * Every event on this channel is flushed immediately after it is queued,
+ * using the stack.
+ *
+ * This delivery type should be used with caution, since it can cause
+ * unexpected call chains, resource starvation, and the like.
+ **/
DELIV_IMMEDIATE,
} deliv_strategy_t;