Avoid adding elements to QueueingThread if it's stopped. (#596)
* Avoid adding elements to QueueingThread if it's stopped.
Background:-
-> If a thread has called CAQueueingThreadStop(), it signals the condition variable
to wake up the CAQueueingThreadBaseRoutine.
-> After signaling, it waits on the same condition variable
to wait for the completion of CAQueueingThreadBaseRoutine.
-> CAQueueingThreadBaseRoutine will finish its current task and signals the condition variable.
-> CAQueueingThreadStop should wake up upon signal and return back to caller.
Issue:-
-> CAQueueingThreadAddData also signals the condition variable which can wake up the thread that called CAQueueingThreadStop.
-> CAQueueingThreadStop returns back to caller assuming that the CAQueueingThreadBaseRoutine has stopped. But it could still be running which might
result in race condition/unwanted behavior.
This will have a positive impact for CONPRO-1515 in which IP send thread was not stopped during OCStop() and new requests were getting added.
https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/596/commits/
a9cc86c208e1cf19d2725681d9e45dcb9ec8f663
(cherry-picked from
a9cc86c208e1cf19d2725681d9e45dcb9ec8f663)
Signed-off-by: Senthil Kumar G S <senthil.gs@samsung.com>
* Indentation fix.
Change-Id: Iad6b385b0bf77bc1a9fabc1525a9acbcecc5bef3
Signed-off-by: Sudipto Bal <sudipto.bal@samsung.com>