[Lldb-commits] [PATCH] Fix TestCreateAfterAttach on Windows

Adrian McCarthy amccarth at google.com
Tue Jun 30 15:45:42 PDT 2015


================
Comment at: test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py:83
@@ -80,1 +82,3 @@
+        # std::thread may cause the program to spin up a thread pool (and it does on
+        # Windows), so the thread numbers are non-deterministic.
 
----------------
chaoren wrote:
> I thought these thread numbers are assigned by order of creation. When you say non-deterministic, do you mean the new thread notifications (if it exists on Windows), come in non-deterministic order? Even if the thread creations are separated by a long interval?
Microsoft's std::thread implementation seems to spin up a thread pool when you create your first thread.  On my machine, it immediately creates three new threads, and which if them is actually tasked to do the work seems to be non-deterministic.

================
Comment at: test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py:104
@@ -100,4 +103,3 @@
             substrs = ['stopped',
-                       'thread #1',
-                       'thread #2',
-                       '* thread #3',
+                       '* thread #',
+                       'thread_2_func',
----------------
chaoren wrote:
> It should still show 3 threads on Windows right? Just in non-deterministic order?
> 
> Would something like `'(thread #(\\n|.)+){3}'` work?
Nope, the thread pool may contain spare threads.  At times, I've seen about three more threads than the program has explicitly created.  I believe one of the threads may be to manage the thread pool.

http://reviews.llvm.org/D10850

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the lldb-commits mailing list