Merge pull request #1261 from spevans/pr_nslocktest_fix

diff --git a/TestFoundation/TestNSLock.swift b/TestFoundation/TestNSLock.swift
index 9191ade..0b5ef46 100644
--- a/TestFoundation/TestNSLock.swift
+++ b/TestFoundation/TestNSLock.swift
@@ -41,11 +41,14 @@
         }
 
         let thread = Thread() {
+            lock.lock()
+
+            // Now wake up the main thread so it can try to obtain the lock that
+            // this thread just obtained.
             condition.lock()
             condition.signal()
             condition.unlock()
 
-            lock.lock()
             Thread.sleep(forTimeInterval: 8)
             lock.unlock()
         }