[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
| Re: [mosquitto-dev] libmosquitto issues | 
On Sat, Dec 10, 2016 at 7:30 AM, Sansheel
<sansheel.kokne@xxxxxxxxxxxxxxxx> wrote:
> Hello,
>
>         I am using "libmosquitto" for my MQTT client code and i am having an
> issue with mosquitto_loop_forever() API getting exited with an error.
> The error says "INVALID FUNCTION ARGUMENT PROVIDED".
The only reason for mosquitto_loop_forever() to return MOSQ_ERR_INVAL
is if the function parameters were invalid - like the "mosq" argument
being NULL.
> ->    After initialization, a thread is created where
> mosquitto_loop_forever() ran.
> ->    Please find the thread function MqttLoopFun() below fnMqttInit()
> function.
> ->    After initialization and thread creation, some subscription and
> publishing is done periodically.
If you're creating your own threads, please make sure you follow the
information given in the first paragraph of the documentation in
mosquitto.h:
 *  If your application uses threads you must use <mosquitto_threaded_set> to
 *  tell the library this is the case, otherwise it makes some optimisations
 *  for the single threaded case that may result in unexpected behaviour for
 *  the multi threaded case.
Regards,
Roger