diff options
author | Martin Willi <martin@revosec.ch> | 2013-07-02 11:00:27 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2013-07-18 16:00:29 +0200 |
commit | 50720d7ce91e2c260798052156f056734d5a751f (patch) | |
tree | 7c9b1cf5bdfca5c1c6bd8099eef581a02caeba43 | |
parent | a0e3a7363f0f0c2f1189358dd6670b05d59ede70 (diff) | |
download | strongswan-50720d7ce91e2c260798052156f056734d5a751f.tar.bz2 strongswan-50720d7ce91e2c260798052156f056734d5a751f.tar.xz |
processor: add a getter for the threads passed to set_threads()
-rw-r--r-- | src/libstrongswan/processing/processor.c | 8 | ||||
-rw-r--r-- | src/libstrongswan/processing/processor.h | 10 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/libstrongswan/processing/processor.c b/src/libstrongswan/processing/processor.c index 605a7af75..c465f0259 100644 --- a/src/libstrongswan/processing/processor.c +++ b/src/libstrongswan/processing/processor.c @@ -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; } - diff --git a/src/libstrongswan/processing/processor.h b/src/libstrongswan/processing/processor.h index 94860f5d3..bd708fba8 100644 --- a/src/libstrongswan/processing/processor.h +++ b/src/libstrongswan/processing/processor.h @@ -88,6 +88,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. */ |