Commit 25a7e2b1 authored by Ian Craggs's avatar Ian Craggs

Make it clear that yield and receive are not intended for multi threaded mode

Bug: 474748
parent 5deab80d
......@@ -28,6 +28,7 @@
* Ian Craggs - fix for bug 447672 - simultaneous access to socket structure
* Ian Craggs - fix for bug 459791 - deadlock in WaitForCompletion for bad client
* Ian Craggs - fix for bug 474905 - insufficient synchronization for subscribe, unsubscribe, connect
* Ian Craggs - make it clear that yield and receive are not intended for multi-threaded mode (bug 474748)
*******************************************************************************/
/**
......@@ -1747,7 +1748,8 @@ int MQTTClient_receive(MQTTClient handle, char** topicName, int* topicLen, MQTTC
MQTTClients* m = handle;
FUNC_ENTRY;
if (m == NULL || m->c == NULL)
if (m == NULL || m->c == NULL
|| running) /* receive is not meant to be called in a multi-thread environment */
{
rc = MQTTCLIENT_FAILURE;
goto exit;
......@@ -1801,7 +1803,7 @@ void MQTTClient_yield(void)
int rc = 0;
FUNC_ENTRY;
if (running)
if (running) /* yield is not meant to be called in a multi-thread environment */
{
MQTTClient_sleep(timeout);
goto exit;
......
......@@ -33,8 +33,9 @@
*
* Both libraries are designed to be sparing in the use of threads. So multiple client objects are
* handled by one or two threads, with a select call in Socket_getReadySocket(), used to determine
* when a socket has incoming data. MQTTClient is not safe to be called from multiple threads,
* whereas MQTTAsync is.
* when a socket has incoming data. This API is thread safe: functions may be called by multiple application
* threads, with the exception of ::MQTTClient_yield and ::MQTTClient_receive, which are intended
* for single threaded environments only.
*
* @endcond
* @cond MQTTClient_main
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment