touch: remove data race condition 36/12036/2
authorGiWoong Kim <giwoong.kim@samsung.com>
Mon, 11 Nov 2013 08:46:52 +0000 (17:46 +0900)
committerGiWoong Kim <giwoong.kim@samsung.com>
Tue, 12 Nov 2013 01:42:50 +0000 (10:42 +0900)
There is no need to reset the ring buffer counter
in the pthread lock section.

Change-Id: I86f46a5ff5c38fc57e9f6d58b4d49f8905c5c648
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/hw/maru_virtio_touchscreen.c

index e19731943645c46163ddb434e3e855ece70a80b7..816bf1ef97d38a001c79a9e6b53aa0f8d79c8bc1 100644 (file)
@@ -319,11 +319,14 @@ static int virtio_touchscreen_device_init(VirtIODevice *vdev)
 
     /* reset the counters */
     pthread_mutex_lock(&event_mutex);
-    event_queue_cnt = event_ringbuf_cnt = 0;
+    event_queue_cnt = 0;
     pthread_mutex_unlock(&event_mutex);
 
+    event_ringbuf_cnt = 0;
+    elem_ringbuf_cnt = 0;
+
     pthread_mutex_lock(&elem_mutex);
-    elem_queue_cnt = elem_ringbuf_cnt = 0;
+    elem_queue_cnt = 0;
 
     ts->waitBuf = false;
     pthread_mutex_unlock(&elem_mutex);