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>
Thu, 19 Feb 2015 03:38:11 +0000 (03:38 +0000)
commit73b122b0590bc350c1a451d7d05db86e3f0121d3
treeb44949de1819693688addf7c04c8fccb05502904
parentf39c856a8150fd8e313034f0d5a4e5f2d3ecdc83
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>
resource/examples/devicediscoveryclient.cpp