]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Pluto's fetcher thread is now created via libstrongswan.
authorTobias Brunner <tobias@strongswan.org>
Sat, 26 Dec 2009 14:49:15 +0000 (15:49 +0100)
committerTobias Brunner <tobias@strongswan.org>
Sat, 26 Dec 2009 14:50:34 +0000 (15:50 +0100)
src/pluto/fetch.c

index 07425ad8740a1cc9826e68f4fe899bd31cb69a39..3c2a66c3051d9174c280fb4ae1199030bbdbb9d4 100644 (file)
@@ -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");