gTimeoutSTM :: Exception e => Int -> STM (Maybe a) -> e -> IO a
-- | retries to execute an 'STM' action for for some specified 'Microseconds'
gTimeoutSTM μs action ex = do
  isDelayOver <- registerDelay μs
  atomically $ do isOver <- readTVar isDelayOver
                  if isOver
                     then throwSTM ex
                     else do result <- action
                             maybe retry {-or-} return result


gTimeoutSTM :: Exception e => Int -> STM (Maybe a) -> e -> IO a
gTimeoutSTM μs action ex = do
  isDelayOver <- registerDelay μs
  atomically $ do isOver <- readTVar isDelayOver
                  if isOver
                     then throwSTM ex
                     else do result <- action
                             maybe retry {-or-} return result
gTimeoutSTM μs action ex = do
  isDelayOver <- registerDelay μs
  atomically $ do isOver <- readTVar isDelayOver
                  if isOver
                     then throwSTM ex
                     else do result <- action
                             maybe retry {-or-} return result