]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
processor: add a getter for the threads passed to set_threads()
authorMartin Willi <martin@revosec.ch>
Tue, 2 Jul 2013 09:00:27 +0000 (11:00 +0200)
committerMartin Willi <martin@revosec.ch>
Wed, 17 Jul 2013 14:55:49 +0000 (16:55 +0200)
src/libstrongswan/processing/processor.c
src/libstrongswan/processing/processor.h

index 605a7af75b0e681c92412f520a2e1a7ff312ae03..c465f02591a8d89cb6255043619da995019b7a7b 100644 (file)
@@ -437,6 +437,12 @@ METHOD(processor_t, set_threads, void,
        this->mutex->unlock(this->mutex);
 }
 
+METHOD(processor_t, get_threads, u_int,
+       private_processor_t *this)
+{
+       return this->desired_threads;
+}
+
 METHOD(processor_t, cancel, void,
        private_processor_t *this)
 {
@@ -507,6 +513,7 @@ processor_t *processor_create()
                        .get_job_load = _get_job_load,
                        .queue_job = _queue_job,
                        .set_threads = _set_threads,
+                       .get_threads = _get_threads,
                        .cancel = _cancel,
                        .destroy = _destroy,
                },
@@ -525,4 +532,3 @@ processor_t *processor_create()
 
        return &this->public;
 }
-
index 94860f5d3c0c033b71bf7981fdc07cdb79714c20..bd708fba86cfda940b3f779e18945d069e7e321a 100644 (file)
@@ -87,6 +87,16 @@ struct processor_t {
         */
        void (*set_threads)(processor_t *this, u_int count);
 
+       /**
+        * Get the number of threads set with set_threads().
+        *
+        * This does not actually reflect the number of threads currently active,
+        * but the number of threads targeted.
+        *
+        * @return                              number of desired threads
+        */
+       u_int (*get_threads)(processor_t *this);
+
        /**
         * Sets the number of threads to 0 and cancels all blocking jobs, then waits
         * for all threads to be terminated.