Fixed regression in CARetransmission from the deadlock fix
authorErich Keane <erich.keane@intel.com>
Fri, 1 May 2015 20:20:13 +0000 (13:20 -0700)
committerErich Keane <erich.keane@intel.com>
Mon, 4 May 2015 22:07:00 +0000 (22:07 +0000)
The fix for the deadlocks resulted in hitting an 'else' case
inadvertantly.  This ensures that no additional waiting happens
on stop.

Change-Id: Ia10a5477e4502b4dff669cdc58d7d7e978e5dc51
Signed-off-by: Erich Keane <erich.keane@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/883
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
resource/csdk/connectivity/src/caretransmission.c

index e4938f5..b8c6f59 100644 (file)
@@ -224,7 +224,7 @@ static void CARetransmissionBaseRoutine(void *threadValue)
 
             OIC_LOG(DEBUG, TAG, "wake up..");
         }
-        else
+        else if (!context->isStop)
         {
             // check each RETRANSMISSION_CHECK_PERIOD_SEC time.
             OIC_LOG_V(DEBUG, TAG, "wait..(%d)microseconds",
@@ -234,6 +234,10 @@ static void CARetransmissionBaseRoutine(void *threadValue)
             uint64_t absTime = RETRANSMISSION_CHECK_PERIOD_SEC * (uint64_t) USECS_PER_SEC;
             ca_cond_wait_for(context->threadCond, context->threadMutex, absTime );
         }
+        else
+        {
+            // we are stopping, so we want to unlock and finish stopping
+        }
 
         // mutex unlock
         ca_mutex_unlock(context->threadMutex);