                 async {
                     XCTAssertTrue(!NSThread.isMainThread())
 
+                    print("testBarrierWithSemaphore() @ \(#line) (\(i+1)/\(self.IterationsPerBarrierStage)): v startingGun.lock() -- postBarrierStage")
+                    startingGun.lock()
+                    print("testBarrierWithSemaphore() @ \(#line) (\(i+1)/\(self.IterationsPerBarrierStage)): ^ startingGun.lock() -- postBarrierStage")
+                    while !startAsyncWork {
+                        print("testBarrierWithSemaphore() @ \(#line) (\(i+1)/\(self.IterationsPerBarrierStage)): v startingGun.wait() -- postBarrierStage")
+                        startingGun.wait()
+                        print("testBarrierWithSemaphore() @ \(#line) (\(i+1)/\(self.IterationsPerBarrierStage)): ^ startingGun.wait() -- postBarrierStage")
+                    }
+                    print("testBarrierWithSemaphore() @ \(#line) (\(i+1)/\(self.IterationsPerBarrierStage)): v startingGun.unlock() -- postBarrierStage")
+                    startingGun.unlock()
+                    print("testBarrierWithSemaphore() @ \(#line) (\(i+1)/\(self.IterationsPerBarrierStage)): ^ startingGun.unlock() -- postBarrierStage")
+
                     print("testBarrierWithSemaphore() @ \(#line) (\(i+1)/\(self.IterationsPerBarrierStage)): v semaphore.lock() -- postBarrierStage")
                     semaphore.lock()
                     print("testBarrierWithSemaphore() @ \(#line) (\(i+1)/\(self.IterationsPerBarrierStage)): ^ semaphore.lock() -- postBarrierStage")
 
-
                     XCTAssertTrue(preBarrierStageCompleted == self.IterationsPerBarrierStage)
                     XCTAssertTrue(inBarrierStageCompleted == self.IterationsPerBarrierStage)
 

    {
        print("testAsyncBarrierFunction() @ \(#line) -- entering function")

        var preBarrierStageCompleted = 0
        var inBarrierStageCompleted = 0
        var postBarrierStageCompleted = 0

        func testBarrierWithSemaphore(semaphore: NSCondition)
        {
            XCTAssertTrue(NSThread.isMainThread())  // we expect tests to run on the main thread

            print("testBarrierWithSemaphore() @ \(#line)")

            for i in 0..<IterationsPerBarrierStage {
                print("testBarrierWithSemaphore() @ \(#line) (\(i+1)/\(self.IterationsPerBarrierStage)): v enter async {} -- preBarrierStage")

                async {
                    XCTAssertTrue(!NSThread.isMainThread())

                    print("testBarrierWithSemaphore() @ \(#line) (\(i+1)/\(self.IterationsPerBarrierStage)): v semaphore.lock() -- preBarrierStage")
                    semaphore.lock()

                print("testBarrierWithSemaphore() @ \(#line) (\(i+1)/\(self.IterationsPerBarrierStage)): ^ leave async {} -- postBarrierStage")
            }

            print("testBarrierWithSemaphore() @ \(#line) -- leaving function")
        }

        print("testAsyncBarrierFunction() @ \(#line): v enter main test loop (will execute \(IterationsOfBarrierTest) times)")
