I remember some time ago on another thread Paul mentioned that Cinder’s
Signal class is not thread-safe. If that’s still the case, how would one go forward with emitting events from another thread?
My case is that I have a thread running a loop in which a hardware device (NFC Reader) is constantly checked and when a new tag is found, I want to emit a signal on the main thread for the user to work with. Something like what
ofNotifyEvent does on Openframeworks by using the Poco lib under the hood.
If that’s not doable with Cinder’s signals, I guess what I can do is to have an
update method in my main thread in which an
atomic<bool> is checked and if it was triggered on the secondary thread, then I emit a signal in
update on the main thread. Does that sound OK or is there another way to achieve this?