Guard against spurious wakeups in devicediscoveryclient.cpp
authorWilliam Dieter <william.r.dieter@intel.com>
Tue, 17 Feb 2015 05:41:32 +0000 (00:41 -0500)
committerSudarshan Prasad <sudarshan.prasad@intel.com>
Sat, 21 Feb 2015 02:06:36 +0000 (02:06 +0000)
commitac1fa8b79c738220bdd3fef27de99faf4a92fb78
tree182a640a1b91ffba4bc44b56f7068bb46ba5eb60
parent75f28ca063449eef486abcbb06b1f49f60f0df92
Guard against spurious wakeups in devicediscoveryclient.cpp

Like most condition variable implementations, std::condition_variable may
wake up spuriously, even though it is not signalled (see
http://en.cppreference.com/w/cpp/thread/condition_variable/wait).  Since
the intention of blocking on the std::condition_variable in main is to
wait forever, add a loop to block again after spurious wakeups.

Change-Id: I19b7ee13650b9b80250f935e2099119611fa61b3
Signed-off-by: William Dieter <william.r.dieter@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/355
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Sudarshan Prasad <sudarshan.prasad@intel.com>
(cherry picked from commit 73b122b0590bc350c1a451d7d05db86e3f0121d3)
Reviewed-on: https://gerrit.iotivity.org/gerrit/392
resource/examples/devicediscoveryclient.cpp