[Opendnssec-commits] matthijs r6956 - in branches/OpenDNSSEC-1.3/signer/src: daemon shared

commits at svn.opendnssec.org commits at svn.opendnssec.org
Thu Jan 17 11:57:36 CET 2013


Author: matthijs
Date: Thu Jan 17 11:57:36 2013
New Revision: 6956
URL: http://fisheye.opendnssec.org/changelog/opendnssec?cs=6956

Log:
backport some fixes in trunk to 1.3 branch. Possibly related to OPENDNSSEC-354 and SUPPORT-48

Modified:
   branches/OpenDNSSEC-1.3/signer/src/daemon/worker.c
   branches/OpenDNSSEC-1.3/signer/src/daemon/worker.h
   branches/OpenDNSSEC-1.3/signer/src/shared/util.c

Modified: branches/OpenDNSSEC-1.3/signer/src/daemon/worker.c
==============================================================================
--- branches/OpenDNSSEC-1.3/signer/src/daemon/worker.c	Thu Jan 17 11:49:12 2013	(r6955)
+++ branches/OpenDNSSEC-1.3/signer/src/daemon/worker.c	Thu Jan 17 11:57:36 2013	(r6956)
@@ -300,6 +300,7 @@
                 if (!worker->need_to_exit) {
                     worker_sleep_unless(worker, 0);
                 }
+                lock_basic_lock(&worker->worker_lock);
                 if (worker->jobs_failed) {
                     ods_log_error("[%s[%i]] sign zone %s failed: %u "
                         "RRsets failed", worker2str(worker->type),
@@ -328,6 +329,7 @@
                 worker->jobs_appointed = 0;
                 worker->jobs_completed = 0;
                 worker->jobs_failed = 0;
+                lock_basic_unlock(&worker->worker_lock);
                 /* stop timer */
                 end = time(NULL);
                 if (status == ODS_STATUS_OK && zone->stats) {
@@ -613,6 +615,13 @@
         lock_basic_lock(&worker->engine->signq->q_lock);
         /* [LOCK] schedule */
         rrset = (rrset_type*) fifoq_pop(worker->engine->signq, &chief);
+        if (!rrset) {
+            ods_log_deeebug("[%s[%i]] nothing to do", worker2str(worker->type),
+                worker->thread_num);
+            worker_wait_locked(&engine->signq->q_lock,
+                &engine->signq->q_threshold);
+            rrset = (rrset_type*) fifoq_pop(engine->signq, &chief);
+        }
         /* [UNLOCK] schedule */
         lock_basic_unlock(&worker->engine->signq->q_lock);
         if (rrset) {
@@ -655,12 +664,6 @@
                     chief->thread_num);
                 worker_wakeup(chief);
             }
-        } else {
-            ods_log_debug("[%s[%i]] nothing to do", worker2str(worker->type),
-                worker->thread_num);
-
-            worker_wait(&worker->engine->signq->q_lock,
-                &worker->engine->signq->q_threshold);
         }
     }
     /* stop drudger */
@@ -812,6 +815,18 @@
     return;
 }
 
+
+/**
+ * Worker waiting on an already locked cond.
+ *
+ */
+void
+worker_wait_locked(lock_basic_type* lock, cond_basic_type* condition)
+{
+    worker_wait_timeout_locked(lock, condition, 0);
+    return;
+}
+
 
 /**
  * Notify a worker.

Modified: branches/OpenDNSSEC-1.3/signer/src/daemon/worker.h
==============================================================================
--- branches/OpenDNSSEC-1.3/signer/src/daemon/worker.h	Thu Jan 17 11:49:12 2013	(r6955)
+++ branches/OpenDNSSEC-1.3/signer/src/daemon/worker.h	Thu Jan 17 11:57:36 2013	(r6956)
@@ -122,6 +122,14 @@
 void worker_wait(lock_basic_type* lock, cond_basic_type* condition);
 
 /**
+ * Let worker wait on an already locked cond.
+ * \param[in] lock lock to use
+ * \param[in] condition condition to be met
+ *
+ */
+void worker_wait_locked(lock_basic_type* lock, cond_basic_type* condition);
+
+/**
  * Let worker wait.
  * \param[in] lock lock to use
  * \param[in] condition condition to be met
@@ -132,7 +140,7 @@
     time_t timeout);
 
 /**
- * Let worker wait on an already locked cond
+ * Let worker wait on an already locked cond.
  * \param[in] lock lock to use
  * \param[in] condition condition to be met
  * \param[in] timeout maximum waiting time in seconds

Modified: branches/OpenDNSSEC-1.3/signer/src/shared/util.c
==============================================================================
--- branches/OpenDNSSEC-1.3/signer/src/shared/util.c	Thu Jan 17 11:49:12 2013	(r6955)
+++ branches/OpenDNSSEC-1.3/signer/src/shared/util.c	Thu Jan 17 11:57:36 2013	(r6956)
@@ -265,7 +265,7 @@
         errno = ENOENT;
         return -1;
     }
-    pid = strtol(pidbuf, &t, 10);
+    pid = (pid_t) strtol(pidbuf, &t, 10);
 
     if (*t && *t != '\n') {
         return -1;



More information about the Opendnssec-commits mailing list