Misc updates#15
Open
artificiel wants to merge 10 commits into
Open
Conversation
the previous implementation processed a single MQTT Message per update cycle. if things are coming in fast, a backlog accumulates. this mechanism re-triggers update if a message was received. the example app has been augmented with some key functions; hit '2' to set the framerate to 2, it will exacerbate the behaviour. it 's' to toggle between self-loop and "old school" updates, and use 'b' to send bursts. when running at fps=2 and self_loop = false, the queueing behavior is evident.
the ofxThreadedMQTT class implements the native mosquitto pthread support, and provides a thread-safe threadChannel interface to the messages. The class hierarchy is preferred to a constructor/setup variable as these bool are opaque and not self-documenting. A class named ofxThreadedMQTT is self-documenting (and the possible feature of live-toggling between threaded and non-threaded is probably not useful as the 2 approaches are no so directly compatible). The upcoming mosquitto 2.1 supports the threads on Windows (currently only POSIX). An example is provided.
Author
|
NOTE: this threading implementation maintains the notification callbacks for online/offline state change; this can possibly not be thread-safe (but it hasn't bitten us). an additional "administrative" threadChannel could be used to synchronize these in parallel to the actual messages. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
a number of changes (1 per commit) culminating in thread support (I see it was once there and removed; we have a data-intensive app that benefits from mosquitto's own thread; it works for us with > 500 messages per second).