Merge "res_sorcery_memory_cache.c: Fix deadlock with scheduler."
authorJoshua Colp <jcolp@digium.com>
Fri, 2 Oct 2015 21:28:09 +0000 (16:28 -0500)
committerGerrit Code Review <gerrit2@gerrit.digium.api>
Fri, 2 Oct 2015 21:28:10 +0000 (16:28 -0500)
main/sched.c

index 8f9e84b..a7e6703 100644 (file)
@@ -450,6 +450,17 @@ static int sched_settime(struct timeval *t, int when)
 {
        struct timeval now = ast_tvnow();
 
+       if (when < 0) {
+               /*
+                * A negative when value is likely a bug as it
+                * represents a VERY large timeout time.
+                */
+               ast_log(LOG_WARNING,
+                       "Bug likely: Negative time interval %d (interpreted as %u ms) requested!\n",
+                       when, (unsigned int) when);
+               ast_assert(0);
+       }
+
        /*ast_debug(1, "TV -> %lu,%lu\n", tv->tv_sec, tv->tv_usec);*/
        if (ast_tvzero(*t))     /* not supplied, default to now */
                *t = now;