diff --git a/satella/coding/concurrent/sync.py b/satella/coding/concurrent/sync.py
index 9dda7e2ce929b27e9c167ffc5cef1670e527fa62..c1bd66765140f0569e5ad1aa9e4b65e61ab2f721 100644
--- a/satella/coding/concurrent/sync.py
+++ b/satella/coding/concurrent/sync.py
@@ -19,6 +19,17 @@ def _while_sync_threadpool(tpe, max_wait, measurement, futures):
         time.sleep(0.5)
 
 
+def _max_wait_atm_n(measurement, max_wait, atm_n):
+    while measurement() < max_wait:
+        try:
+            atm_n.wait_until_equal(0, 1)
+            break
+        except WouldWaitMore:
+            continue
+    else:
+        raise WouldWaitMore('timeout exceeded')
+
+
 def sync_threadpool(tpe: tp.Union[ExecutorWrapper, ThreadPoolExecutor],
                     max_wait: tp.Optional[float] = None) -> None:
     """
@@ -54,13 +65,6 @@ def sync_threadpool(tpe: tp.Union[ExecutorWrapper, ThreadPoolExecutor],
         if max_wait is None:
             atm_n.wait_until_equal(0)
         else:
-            while measurement() < max_wait:
-                try:
-                    atm_n.wait_until_equal(0, 1)
-                    break
-                except WouldWaitMore:
-                    continue
-            else:
-                raise WouldWaitMore('timeout exceeded')
+            _max_wait_atm_n(measurement, max_wait, atm_n)
         cond.notify_all()
         wait(futures)