From 9a53b8f2bc3c2ac366d208b620d6404e936e2a92 Mon Sep 17 00:00:00 2001 From: BALATON Zoltan Date: Tue, 5 May 2015 01:16:38 +0200 Subject: Update fdr implementation for thread function changes in latest libimobiledevice version --- src/thread.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'src/thread.c') diff --git a/src/thread.c b/src/thread.c index d6d6c1a..fdc8112 100644 --- a/src/thread.c +++ b/src/thread.c @@ -8,26 +8,26 @@ * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "thread.h" -int thread_create(thread_t *thread, thread_func_t thread_func, void* data) +int thread_new(thread_t *thread, thread_func_t thread_func, void* data) { #ifdef WIN32 HANDLE th = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)thread_func, data, 0, NULL); - if (th == NULL) { + if (th == NULL) { return -1; - } + } *thread = th; return 0; #else @@ -36,6 +36,13 @@ int thread_create(thread_t *thread, thread_func_t thread_func, void* data) #endif } +void thread_free(thread_t thread) +{ +#ifdef WIN32 + CloseHandle(thread); +#endif +} + void thread_join(thread_t thread) { /* wait for thread to complete */ @@ -95,5 +102,5 @@ void thread_once(thread_once_t *once_control, void (*init_routine)(void)) InterlockedExchange(&(once_control->lock), 0); #else pthread_once(once_control, init_routine); -#endif +#endif } -- cgit v1.1-32-gdbae