Avoid adding elements to QueueingThread if it's already stopped. 34/204734/1 accepted/tizen/unified/20190429.103659 submit/tizen/20190426.041844
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:17:52 +0000 (13:17 +0900)
commitc04ac05a42d644464490feecf905cfd4aaf64b76
treeb7a444dd6ec2ddfd56b433a37a2c2034a711e7e2
parentdee64b10be2b0c9345e8974df26a39d6d5904e75
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