summaryrefslogtreecommitdiffstats
path: root/src/sbservices.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sbservices.c')
-rw-r--r--src/sbservices.c24
1 files changed, 4 insertions, 20 deletions
diff --git a/src/sbservices.c b/src/sbservices.c
index 00f2862..1cd17db 100644
--- a/src/sbservices.c
+++ b/src/sbservices.c
@@ -36,11 +36,7 @@
36static void sbs_lock(sbservices_client_t client) 36static void sbs_lock(sbservices_client_t client)
37{ 37{
38 debug_info("SBServices: Locked"); 38 debug_info("SBServices: Locked");
39#ifdef WIN32 39 mutex_lock(&client->mutex);
40 EnterCriticalSection(&client->mutex);
41#else
42 pthread_mutex_lock(&client->mutex);
43#endif
44} 40}
45 41
46/** 42/**
@@ -51,11 +47,7 @@ static void sbs_lock(sbservices_client_t client)
51static void sbs_unlock(sbservices_client_t client) 47static void sbs_unlock(sbservices_client_t client)
52{ 48{
53 debug_info("SBServices: Unlocked"); 49 debug_info("SBServices: Unlocked");
54#ifdef WIN32 50 mutex_unlock(&client->mutex);
55 LeaveCriticalSection(&client->mutex);
56#else
57 pthread_mutex_unlock(&client->mutex);
58#endif
59} 51}
60 52
61/** 53/**
@@ -105,11 +97,7 @@ sbservices_error_t sbservices_client_new(idevice_t device, lockdownd_service_des
105 97
106 sbservices_client_t client_loc = (sbservices_client_t) malloc(sizeof(struct sbservices_client_private)); 98 sbservices_client_t client_loc = (sbservices_client_t) malloc(sizeof(struct sbservices_client_private));
107 client_loc->parent = plistclient; 99 client_loc->parent = plistclient;
108#ifdef WIN32 100 mutex_init(&client_loc->mutex);
109 InitializeCriticalSection(&client_loc->mutex);
110#else
111 pthread_mutex_init(&client_loc->mutex, NULL);
112#endif
113 101
114 *client = client_loc; 102 *client = client_loc;
115 return SBSERVICES_E_SUCCESS; 103 return SBSERVICES_E_SUCCESS;
@@ -131,11 +119,7 @@ sbservices_error_t sbservices_client_free(sbservices_client_t client)
131 119
132 sbservices_error_t err = sbservices_error(property_list_service_client_free(client->parent)); 120 sbservices_error_t err = sbservices_error(property_list_service_client_free(client->parent));
133 client->parent = NULL; 121 client->parent = NULL;
134#ifdef WIN32 122 mutex_destroy(&client->mutex);
135 DeleteCriticalSection(&client->mutex);
136#else
137 pthread_mutex_destroy(&client->mutex);
138#endif
139 free(client); 123 free(client);
140 124
141 return err; 125 return err;