private static void syncWithThread(CountDownLatch startLatch, String threadName, String methodName) {
    try {
      startLatch.countDown();
      startLatch.await(5, TimeUnit.SECONDS);
    } catch (InterruptedException ignored) {
      System.out.printf("[spock.lang.Timeout] Could not sync with %s thread for method '%s'", threadName, methodName);
    }
  }
Times out a method invocation if it takes too long. The method invocation
will occur on the regular test framework thread. This can be important
for integration tests with thread-local state.

@author Peter Niederwieser
spock-core/src/main/java/org/spockframework/runtime/extension/builtin/TimeoutInterceptor.java