Guard against spurious wakeups in devicediscoveryserver.cpp
authorWilliam Dieter <william.r.dieter@intel.com>
Tue, 17 Feb 2015 06:45:00 +0000 (01:45 -0500)
committerSudarshan Prasad <sudarshan.prasad@intel.com>
Sat, 21 Feb 2015 02:05:42 +0000 (02:05 +0000)
commit75f28ca063449eef486abcbb06b1f49f60f0df92
treee32018d6e4b9ab639223ea6a42d456e91386a7b0
parent1b9b7ae5d2a27dd8f44d0d3e65c216c9cb27c1bc
Guard against spurious wakeups in devicediscoveryserver.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: I97e89a1ec95d6ba65eeb7daff861ee0a65d03a7e
Signed-off-by: William Dieter <william.r.dieter@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/357
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Sudarshan Prasad <sudarshan.prasad@intel.com>
(cherry picked from commit 5df6036cde74bf174d9d61b618d81f8d7034d6c4)
Reviewed-on: https://gerrit.iotivity.org/gerrit/391
resource/examples/devicediscoveryserver.cpp