diff options
author | Nikias Bassen | 2011-09-03 02:07:09 +0200 |
---|---|---|
committer | Martin Szulecki | 2012-03-18 20:40:54 +0100 |
commit | 6a83ef58a1032e3b336587e2f3a19659ae325c25 (patch) | |
tree | 27e12297bc66bd22a0cfc86459413a49a0d998f2 /src/afc.c | |
parent | b586203dbef26f9e94325b57867478eda504e5a1 (diff) | |
download | libimobiledevice-6a83ef58a1032e3b336587e2f3a19659ae325c25.tar.gz libimobiledevice-6a83ef58a1032e3b336587e2f3a19659ae325c25.tar.bz2 |
Remove gthread dependency and use pthreads instead
Diffstat (limited to 'src/afc.c')
-rw-r--r-- | src/afc.c | 18 |
1 files changed, 4 insertions, 14 deletions
@@ -39,7 +39,7 @@ static const int MAXIMUM_PACKET_SIZE = (2 << 15); static void afc_lock(afc_client_t client) { debug_info("Locked"); - g_mutex_lock(client->mutex); + pthread_mutex_lock(&client->mutex); } /** @@ -50,7 +50,7 @@ static void afc_lock(afc_client_t client) static void afc_unlock(afc_client_t client) { debug_info("Unlocked"); - g_mutex_unlock(client->mutex); + pthread_mutex_unlock(&client->mutex); } /** @@ -69,10 +69,6 @@ static void afc_unlock(afc_client_t client) afc_error_t afc_client_new_from_connection(idevice_connection_t connection, afc_client_t *client) { - /* makes sure thread environment is available */ - if (!g_thread_supported()) - g_thread_init(NULL); - if (!connection) return AFC_E_INVALID_ARG; @@ -93,7 +89,7 @@ afc_error_t afc_client_new_from_connection(idevice_connection_t connection, afc_ memcpy(client_loc->afc_packet->magic, AFC_MAGIC, AFC_MAGIC_LEN); client_loc->file_handle = 0; client_loc->lock = 0; - client_loc->mutex = g_mutex_new(); + pthread_mutex_init(&client_loc->mutex, NULL); *client = client_loc; return AFC_E_SUCCESS; @@ -117,10 +113,6 @@ afc_error_t afc_client_new_from_connection(idevice_connection_t connection, afc_ */ afc_error_t afc_client_new(idevice_t device, uint16_t port, afc_client_t * client) { - /* makes sure thread environment is available */ - if (!g_thread_supported()) - g_thread_init(NULL); - if (!device || port==0) return AFC_E_INVALID_ARG; @@ -155,9 +147,7 @@ afc_error_t afc_client_free(afc_client_t client) client->connection = NULL; } free(client->afc_packet); - if (client->mutex) { - g_mutex_free(client->mutex); - } + pthread_mutex_destroy(&client->mutex); free(client); return AFC_E_SUCCESS; } |