Fixed a pair of deadlocks on shutdown
In the event where a condition variable was signaled before it
was waited on, the thread would fail to exit properly and be
deadlocked.
This fix correctly checks the stop value before locking, and ensures
that signalling is done in a locked context as well.
Change-Id: Iab19adcee854a1ca1531deea29fa3bb6c82d042f
Signed-off-by: Erich Keane <erich.keane@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/874
Reviewed-by: Joseph Morrow <joseph.l.morrow@intel.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>