aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2009-12-26 15:49:15 +0100
committerTobias Brunner <tobias@strongswan.org>2009-12-26 15:50:34 +0100
commite9a1852aac7ce3af9b4a9e89dac836fb10d6dc85 (patch)
tree488963c272c5dcd38a2b920bce1afb1c5bdc5ae2 /src
parentc5454eaf6112cdda5ee4435ccb1e69d2abf33f55 (diff)
downloadstrongswan-e9a1852aac7ce3af9b4a9e89dac836fb10d6dc85.tar.bz2
strongswan-e9a1852aac7ce3af9b4a9e89dac836fb10d6dc85.tar.xz
Pluto's fetcher thread is now created via libstrongswan.
Diffstat (limited to 'src')
-rw-r--r--src/pluto/fetch.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/pluto/fetch.c b/src/pluto/fetch.c
index 07425ad87..3c2a66c30 100644
--- a/src/pluto/fetch.c
+++ b/src/pluto/fetch.c
@@ -29,6 +29,9 @@
#include <debug.h>
#include <asn1/asn1.h>
#include <credentials/certificates/certificate.h>
+#ifdef THREADS
+#include <threading/thread.h>
+#endif
#include "constants.h"
#include "defs.h"
@@ -56,7 +59,7 @@ static fetch_req_t *crl_fetch_reqs = NULL;
static ocsp_location_t *ocsp_fetch_reqs = NULL;
#ifdef THREADS
-static pthread_t thread;
+static thread_t *thread;
static pthread_mutex_t certs_and_keys_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t authcert_list_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t crl_list_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -496,11 +499,15 @@ void init_fetch(void)
if (crl_check_interval > 0)
{
#ifdef THREADS
- int status = pthread_create( &thread, NULL, fetch_thread, NULL);
+ thread = thread_create((thread_main_t)fetch_thread, NULL);
- if (status != 0)
+ if (thread == NULL)
+ {
+ plog("fetching thread could not be started");
+ }
+ else
{
- plog("fetching thread could not be started, status = %d", status);
+ thread->detach(thread);
}
#else /* !THREADS */
plog("warning: not compiled with pthread support");