diff options
author | Tobias Brunner <tobias@strongswan.org> | 2012-06-19 13:29:09 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2012-06-25 17:38:59 +0200 |
commit | 26d77eb3e61b2ff929dff96bbb53a5d22d76ce4f (patch) | |
tree | 5d5b7bd7bb2cd6a721c65b82f8ce2a8b3f4fdf22 /src/libcharon/daemon.c | |
parent | 7fec83af28f233a02b7ae08c6fd4de65799cb6b4 (diff) | |
download | strongswan-26d77eb3e61b2ff929dff96bbb53a5d22d76ce4f.tar.bz2 strongswan-26d77eb3e61b2ff929dff96bbb53a5d22d76ce4f.tar.xz |
Centralized thread cancellation in processor_t
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.
Diffstat (limited to 'src/libcharon/daemon.c')
-rw-r--r-- | src/libcharon/daemon.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libcharon/daemon.c b/src/libcharon/daemon.c index 60a32339d..8a4b3906f 100644 --- a/src/libcharon/daemon.c +++ b/src/libcharon/daemon.c @@ -113,6 +113,10 @@ static void destroy(private_daemon_t *this) { this->public.sender->flush(this->public.sender); } + + /* cancel all threads and wait for their termination */ + lib->processor->cancel(lib->processor); + DESTROY_IF(this->public.receiver); #ifdef ME DESTROY_IF(this->public.connect_manager); @@ -120,7 +124,6 @@ static void destroy(private_daemon_t *this) #endif /* ME */ /* make sure the cache is clear before unloading plugins */ lib->credmgr->flush_cache(lib->credmgr, CERT_ANY); - /* unload plugins to release threads */ lib->plugins->unload(lib->plugins); #ifdef CAPABILITIES_LIBCAP cap_free(this->caps); |