summaryrefslogtreecommitdiffstats
path: root/src/thread.c
diff options
context:
space:
mode:
authorGravatar BALATON Zoltan2015-05-05 01:16:38 +0200
committerGravatar BALATON Zoltan2015-05-05 01:19:41 +0200
commit9a53b8f2bc3c2ac366d208b620d6404e936e2a92 (patch)
tree821796eeb2fc096ffb886aa8fb9b297421065d37 /src/thread.c
parente96e7dea1c2cd12ddb2679b7f91775c48aff4d11 (diff)
downloadidevicerestore-9a53b8f2bc3c2ac366d208b620d6404e936e2a92.tar.gz
idevicerestore-9a53b8f2bc3c2ac366d208b620d6404e936e2a92.tar.bz2
Update fdr implementation for thread function changes in latest
libimobiledevice version
Diffstat (limited to 'src/thread.c')
-rw-r--r--src/thread.c21
1 files changed, 14 insertions, 7 deletions
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
}