summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2009-06-15 05:11:56 +0200
committerGravatar Nikias Bassen2009-06-15 05:11:56 +0200
commitb45560b1a982aab1063eb6fbd65122650efafe9d (patch)
treec3c2ec684ced4788a29d5fb4e081ff9e91123894 /src
parent12c244a76cc6a75a385ddfc5dc44734825383fe2 (diff)
downloadusbmuxd-b45560b1a982aab1063eb6fbd65122650efafe9d.tar.gz
usbmuxd-b45560b1a982aab1063eb6fbd65122650efafe9d.tar.bz2
Additional mutex when writing to device.
Diffstat (limited to 'src')
-rw-r--r--src/main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 99d2a5c..1ee2480 100644
--- a/src/main.c
+++ b/src/main.c
@@ -824,11 +824,11 @@ static void *usbmuxd_client_init_thread(void *arg)
pthread_mutex_unlock(&usbmux_mutex);
// setup connection to iPhone/iPod
-// pthread_mutex_lock(&usbmux_mutex);
+ pthread_mutex_lock(&cur_dev->writer_mutex);
res =
usbmux_new_client(cur_dev->phone, 0, ntohs(c_req->tcp_dport),
&(cdata->muxclient));
-// pthread_mutex_unlock(&usbmux_mutex);
+ pthread_mutex_unlock(&cur_dev->writer_mutex);
if (res != 0) {
usbmuxd_send_result(cdata->socket, c_req->header.tag, res);
@@ -870,7 +870,9 @@ static void *usbmuxd_client_init_thread(void *arg)
// time to clean up
if (cdata && cdata->muxclient) { // should be non-NULL
+ pthread_mutex_lock(&cdata->dev->writer_mutex);
usbmux_free_client(cdata->muxclient);
+ pthread_mutex_unlock(&cdata->dev->writer_mutex);
}
leave: