Make rescheduling a job more predictable
authorTobias Brunner <tobias@strongswan.org>
Thu, 21 Jun 2012 08:10:25 +0000 (10:10 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 25 Jun 2012 15:49:12 +0000 (17:49 +0200)
commite0efd7c121a888625cc1d287c496f1306019b9c7
treec0cbfe50b65c97c0f91599dec54076e9f4a24578
parent26d77eb3e61b2ff929dff96bbb53a5d22d76ce4f
Make rescheduling a job more predictable

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.
src/libcharon/plugins/ha/ha_segments.c
src/libcharon/processing/jobs/inactivity_job.c
src/libstrongswan/processing/jobs/job.h
src/libstrongswan/processing/processor.c