diff options
Diffstat (limited to 'libs/libcurl/src/curl_threads.c')
-rw-r--r-- | libs/libcurl/src/curl_threads.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/libs/libcurl/src/curl_threads.c b/libs/libcurl/src/curl_threads.c index caee0a6df9..c4831471d6 100644 --- a/libs/libcurl/src/curl_threads.c +++ b/libs/libcurl/src/curl_threads.c @@ -35,9 +35,7 @@ #endif
#include "curl_threads.h"
-#ifdef BUILDING_LIBCURL
#include "curl_memory.h"
-#endif
/* The last #include file should be: */
#include "memdebug.h"
@@ -82,11 +80,12 @@ err: return curl_thread_t_null;
}
-void Curl_thread_destroy(curl_thread_t hnd)
+void Curl_thread_destroy(curl_thread_t *hnd)
{
- if(hnd != curl_thread_t_null) {
- pthread_detach(*hnd);
- free(hnd);
+ if(*hnd != curl_thread_t_null) {
+ pthread_detach(**hnd);
+ free(*hnd);
+ *hnd = curl_thread_t_null;
}
}
@@ -138,10 +137,12 @@ curl_thread_t Curl_thread_create( return t;
}
-void Curl_thread_destroy(curl_thread_t hnd)
+void Curl_thread_destroy(curl_thread_t *hnd)
{
- if(hnd != curl_thread_t_null)
- CloseHandle(hnd);
+ if(*hnd != curl_thread_t_null) {
+ CloseHandle(*hnd);
+ *hnd = curl_thread_t_null;
+ }
}
int Curl_thread_join(curl_thread_t *hnd)
@@ -153,9 +154,7 @@ int Curl_thread_join(curl_thread_t *hnd) int ret = (WaitForSingleObjectEx(*hnd, INFINITE, FALSE) == WAIT_OBJECT_0);
#endif
- Curl_thread_destroy(*hnd);
-
- *hnd = curl_thread_t_null;
+ Curl_thread_destroy(hnd);
return ret;
}
|