Skip to content

Commit

Permalink
Add comment on thread safety to mosquitto_broker.h
Browse files Browse the repository at this point in the history
Closes #3080
  • Loading branch information
ralight committed Oct 1, 2024
1 parent 57f0e17 commit 9a5c2bc
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions include/mosquitto_broker.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,20 @@ extern "C" {
#include <stdint.h>
#include <time.h>

/*
* Topic: Threads
* Unless otherwise noted, the functions provided for plugins to use should
* only be called in the context of the main broker thread. This is the thread
* which calls your callbacks.
*
* If you have a separate thread running in your plugin which needs to
* interact with the broker that isn't tied to a specific callback, the
* easiest way to handle this is to use the `tick` event and pass your data
* structure as the userdata argument when you register the callback. Note
* that you still need to ensure appropriate synchronisation between your
* thread and the broker thread using e.g. a mutex.
*/

struct mosquitto;
typedef struct mqtt5__property mosquitto_property;

Expand Down

0 comments on commit 9a5c2bc

Please sign in to comment.