This revision was automatically updated to reflect the committed changes.
Closed by commit rL264846: Fix flakyness in TestWatchpointMultipleThreads 
(authored by labath).

Changed prior to commit:
  http://reviews.llvm.org/D18558?vs=51929&id=52028#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D18558

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/main.cpp

Index: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/main.cpp
===================================================================
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/main.cpp
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/main.cpp
@@ -23,27 +23,23 @@
 access_pool (bool flag = false)
 {
     static std::mutex g_access_mutex;
-    if (!flag)
-        g_access_mutex.lock();
+    g_access_mutex.lock();
 
     uint32_t old_val = g_val;
     if (flag)
     {
         printf("changing g_val to %d...\n", old_val + 1);
         g_val = old_val + 1;
     }
 
-    if (!flag)
-        g_access_mutex.unlock();
+    g_access_mutex.unlock();
     return g_val;
 }
 
 void
 thread_func (uint32_t thread_index)
 {
-    // Break here in order to allow the thread
-    // to inherit the global watchpoint state.
-    printf ("%s (thread index = %u) startng...\n", __FUNCTION__, thread_index);
+    printf ("%s (thread index = %u) starting...\n", __FUNCTION__, 
thread_index);
 
     uint32_t count = 0;
     uint32_t val;
Index: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py
===================================================================
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py
@@ -58,9 +58,6 @@
                        'stop reason = breakpoint'])
 
         # Now let's set a write-type watchpoint for variable 'g_val'.
-        # The main.cpp, by design, misbehaves by not following the agreed upon
-        # protocol of using a mutex while accessing the global pool and by not
-        # writing to the variable.
         self.expect("watchpoint set variable -w write g_val", 
WATCHPOINT_CREATED,
             substrs = ['Watchpoint created', 'size = 4', 'type = w'])
 
@@ -102,9 +99,6 @@
                        'stop reason = breakpoint'])
 
         # Now let's set a write-type watchpoint for variable 'g_val'.
-        # The main.cpp, by design, misbehaves by not following the agreed upon
-        # protocol of using a mutex while accessing the global pool and by not
-        # writing to the variable.
         self.expect("watchpoint set variable -w write g_val", 
WATCHPOINT_CREATED,
             substrs = ['Watchpoint created', 'size = 4', 'type = w'])
 


Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/main.cpp
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/main.cpp
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/main.cpp
@@ -23,27 +23,23 @@
 access_pool (bool flag = false)
 {
     static std::mutex g_access_mutex;
-    if (!flag)
-        g_access_mutex.lock();
+    g_access_mutex.lock();
 
     uint32_t old_val = g_val;
     if (flag)
     {
         printf("changing g_val to %d...\n", old_val + 1);
         g_val = old_val + 1;
     }
 
-    if (!flag)
-        g_access_mutex.unlock();
+    g_access_mutex.unlock();
     return g_val;
 }
 
 void
 thread_func (uint32_t thread_index)
 {
-    // Break here in order to allow the thread
-    // to inherit the global watchpoint state.
-    printf ("%s (thread index = %u) startng...\n", __FUNCTION__, thread_index);
+    printf ("%s (thread index = %u) starting...\n", __FUNCTION__, thread_index);
 
     uint32_t count = 0;
     uint32_t val;
Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py
@@ -58,9 +58,6 @@
                        'stop reason = breakpoint'])
 
         # Now let's set a write-type watchpoint for variable 'g_val'.
-        # The main.cpp, by design, misbehaves by not following the agreed upon
-        # protocol of using a mutex while accessing the global pool and by not
-        # writing to the variable.
         self.expect("watchpoint set variable -w write g_val", WATCHPOINT_CREATED,
             substrs = ['Watchpoint created', 'size = 4', 'type = w'])
 
@@ -102,9 +99,6 @@
                        'stop reason = breakpoint'])
 
         # Now let's set a write-type watchpoint for variable 'g_val'.
-        # The main.cpp, by design, misbehaves by not following the agreed upon
-        # protocol of using a mutex while accessing the global pool and by not
-        # writing to the variable.
         self.expect("watchpoint set variable -w write g_val", WATCHPOINT_CREATED,
             substrs = ['Watchpoint created', 'size = 4', 'type = w'])
 
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to