tor
master
|
DOCDOC. More...
Functions | |
const pubsub_subscriber_t * | pubsub_subscribe_ (pubsub_topic_t *topic, pubsub_subscriber_fn_t fn, void *subscriber_data, unsigned subscribe_flags, unsigned priority) |
int | pubsub_unsubscribe_ (pubsub_topic_t *topic, const pubsub_subscriber_t *s) |
int | pubsub_notify_ (pubsub_topic_t *topic, pubsub_notify_fn_t notify_fn, void *event_data, unsigned notify_flags) |
void | pubsub_clear_ (pubsub_topic_t *topic) |
DOCDOC.
void pubsub_clear_ | ( | pubsub_topic_t * | topic | ) |
Release all storage held by topic.
int pubsub_notify_ | ( | pubsub_topic_t * | topic, |
pubsub_notify_fn_t | notify_fn, | ||
void * | event_data, | ||
unsigned | notify_flags | ||
) |
For every subscriber s in topic, invoke notify_fn on s and event_data. Return 0 if there were no nonzero return values, and -1 if there were any.
const pubsub_subscriber_t* pubsub_subscribe_ | ( | pubsub_topic_t * | topic, |
pubsub_subscriber_fn_t | fn, | ||
void * | subscriber_data, | ||
unsigned | subscribe_flags, | ||
unsigned | priority | ||
) |
Add a new subscriber to topic, where (when an event is triggered), we'll notify the function fn by passing it subscriber_data. Return a handle to the subscribe which can later be passed to pubsub_unsubscribe_().
Functions are called in priority order, from lowest to highest.
See pubsub.h for subscribe_flags.
int pubsub_unsubscribe_ | ( | pubsub_topic_t * | topic, |
const pubsub_subscriber_t * | s | ||
) |
Remove the subscriber s from topic. After calling this function, s may no longer be used.