aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/processing/processor.c
Commit message (Collapse)AuthorAgeFilesLines
* processor: Move priority threads assignment to set_threads()Tobias Brunner2017-05-231-4/+9
| | | | | | This avoids the evaluation of %N even if the thread pool is never used. We need to avoid as many custom printf specifiers as possible when fuzzing our code to avoid excessive log messages.
* processor: Flush pending jobs during cancel(), not destroyMartin Willi2014-05-071-1/+11
| | | | | During shutdown, cancel queued jobs earlier to avoid having cleanup functions accessing infrastructure not available anymore, for example watcher.
* lib: All settings use configured namespaceTobias Brunner2014-02-121-1/+1
|
* processor: force synchronous execute_job() if set_threads(0) has been calledMartin Willi2013-07-191-1/+1
| | | | | | During daemon shutdown, some idle threads might be lingering around even if set_threads(0) already has been called. To avoid any races, we enforce synchronous execution of the job.
* processor: remove the now unused get_threads() method againMartin Willi2013-07-181-7/+0
|
* processor: add an execute_job() method to directly execute an important jobMartin Willi2013-07-181-0/+26
| | | | | | | If all worker threads are busy and waiting for an event, we must ensure that a job delivering that event gets executed. This new method has this property for CRITICAL jobs, using a worker if we have one, but executing the job directly if not.
* processor: add a getter for the threads passed to set_threads()Martin Willi2013-07-181-1/+7
|
* processor: Simplified the main loopTobias Brunner2013-06-281-109/+127
|
* processor: Don't hold the lock while destroying jobsTobias Brunner2013-06-281-38/+66
| | | | | | If a lock is held when queue_job() is called and the same lock is required during the destruction of a job, holding the internal lock in the processor while calling destroy() could result in a deadlock.
* Moved debug.[ch] to utils folderTobias Brunner2012-10-241-1/+1
|
* Moved data structures to new collections subfolderTobias Brunner2012-10-241-1/+1
|
* Make rescheduling a job more predictableTobias Brunner2012-06-251-19/+35
| | | | | | | | | | | | | This avoids race conditions between calls to cancel() and jobs that like to be rescheduled. If jobs were able to reschedule themselves it would theoretically be possible that two worker threads have the same job assigned (the one currently executing the job and the one executing the same but rescheduled job if it already is time to execute it), this means that cancel() could be called twice for that job. Creating a new job based on the current one and reschedule that is also OK, but rescheduling itself is more efficient for jobs that need to be executed often.
* Centralized thread cancellation in processor_tTobias Brunner2012-06-251-19/+54
| | | | | | | | | | This ensures that no threads are active when plugins and the rest of the daemon are unloaded. callback_job_t was simplified a lot in the process as its main functionality is now contained in processor_t. The parent-child relationships were abandoned as these were only needed to simplify job cancellation.
* Give processor_t more control over the lifecycle of a jobTobias Brunner2012-06-251-50/+112
| | | | | | | | | | | Jobs are now destroyed by the processor, but they are allowed to reschedule themselves. That is, parts of the reschedule functionality already provided by callback_job_t is moved to the processor. Not yet fully supported is JOB_REQUEUE_DIRECT and canceling jobs. Note: job_t.destroy() is now called not only for queued jobs but also after execution or cancellation of jobs. job_t.status can be used to decide what to do in said method.
* Log worker thread ID with two digits.Tobias Brunner2011-12-161-2/+2
|
* Fixed compiler warnings regarding enum comparison.Tobias Brunner2011-11-251-1/+1
| | | | | | | | | Warnings like comparison of unsigned expression < 0 is always false are reported with -Wextra when enum types that are compiled to an unsigned type (which is up to the compiler) are checked for negativity.
* Prevent deadlock while shutting down thread pool.Tobias Brunner2011-06-081-2/+2
| | | | | | | | | During destruction the main thread locks the mutex in processor_t and waits on a condvar for threads to have terminated. Because the mutex has also to be locked to decrement the thread count the condvar cannot be signaled before doing that as otherwise the main thread might already be waiting to join the threads while locking the mutex and thus causing a deadlock.
* Update working thread count without allocation.Tobias Brunner2011-05-161-22/+15
|
* Make sure working thread count is correctly updatedTobias Brunner2011-05-161-4/+23
|
* Count number of threads active in each class, and reserve threads only if ↵Martin Willi2011-05-161-16/+57
| | | | none active
* Reserve threads for job priority classes based on strongswan.conf optionsMartin Willi2011-05-161-1/+17
|
* Processor job scheduling respects job priority classesMartin Willi2011-05-161-11/+44
|
* Migrated processor to INIT/METHOD macrosMartin Willi2011-05-051-42/+35
|
* Do not invoke processor restart() if not requiredMartin Willi2011-03-151-1/+2
| | | | | Doing so might result in a deadlock during shutdown if a delayed restart is locked on the bus during the debug statement.
* Remove obsolete pool_size argument in processor_create()Martin Willi2010-11-161-1/+1
|
* Moved scheduler and thread pool to libstrongswan.Tobias Brunner2010-09-021-0/+273