Avoid adding elements to QueueingThread if it's already stopped. 28/204728/1 accepted/tizen/5.0/unified/20190429.011934 submit/tizen_5.0/20190426.041741
authorSenthil Kumar G S <senthil.gs@samsung.com>
Fri, 12 Apr 2019 06:34:12 +0000 (12:04 +0530)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Fri, 26 Apr 2019 04:14:30 +0000 (13:14 +0900)
commitfaddbd1d266d8d5a6f4947779247cd7fa91db84a
tree5dc2d9e9703c3eff2ec11ed6a90a6d05aff3c86d
parent6a37863f263db4f20d5e5082e456b1a5f6059967
Avoid adding elements to QueueingThread if it's already stopped.

Backgraund:-
-> 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.

https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/475
(cherry picked from 069d45ab60a7cd90d451aea4fdcf9d03dda421de)

Change-Id: Ib64d83a2560f31d44cb33148eba4f8b4e9a1289e
Signed-off-by: Senthil Kumar G S <senthil.gs@samsung.com>
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
resource/csdk/connectivity/src/caqueueingthread.c