Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Submission is not thread safe

Hi Laurent,

sorry, I was wrong, and you are right!  Apparently I forgot my intentions in writing the MQTTClient library.  I will update the documentation to be clear on this point.

I am just writing a test for multi threaded access in the MQTTClient library, when setting the callbacks.  I think what you are seeing in subscribe() is a bug, which I will fix.  The calls to publish() seem to be working fine.

Ian

On 08/10/2015 01:22 PM, Laurent FAILLIE wrote:
Thanks for your reply, Ian.

As per the documentation, MQTTClient_setCallbacks() triggers a thread for documents arrival, so I naively thought everything is thread safe.
As of now, I faced issues only when subscribing but my threads are publishing data as well : should I have some risk with that as well ?
 
The misspelling master is on the Web.
  _________ 100 % Dictionnary Free !
/                    /(
/ Dico          / / Pleins d'autres fautes sur
/________ / /
(########( / http://destroyedlolo.info
Quoi, des fautes d'orthographe! Pas possible ;-D.



Le Lundi 10 août 2015 13h39, Ian Craggs <icraggs@xxxxxxxxxxxxxxxxxxxxxxx> a écrit :


Hi Laurent,

thanks for pointing this out, we should definitely make this clear.

The "synchronous" MQTTClient C API is not thread safe, as you have found out.  The asynchronous C API, "MQTTAsync", is.

Ian



On 08/09/2015 11:57 PM, Laurent FAILLIE wrote:
Hello,

I'm using C implementation of Paho library, and my program (https://github.com/destroyedlolo/Marcel) is creating several threads to survey topics values : this tool aims to raise alerts if they are out of margin (as example, it send me an SMS if my photo-voltaic installation didn't produced anything for a day).

In a previous version, first I created childs threads and let them to subscribe to topics ... and my tool crashed at startup due to memory corruption or be disconnected from the broker.

Now, subscriptions is done in the main process and then threads are created : Marcel doesn't crash anymore.

I didn't find any document saying paho subscription is not thread safe, so my mail :)

Best regards,

Laurent

 ---
The misspelling master is on the Web.
  _________ 100 % Dictionnary Free !
/                    /(
/ Dico          / / Pleins d'autres fautes sur
/________ / /
(########( / http://destroyedlolo.info
Quoi, des fautes d'orthographe! Pas possible ;-D.


_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev

-- 
Ian Craggs                          
icraggs@xxxxxxxxxx                 IBM United Kingdom
Paho Project Lead; Committer on Mosquitto


_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev




_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev

-- 
Ian Craggs                          
icraggs@xxxxxxxxxx                 IBM United Kingdom
Paho Project Lead; Committer on Mosquitto


Back to the top