signalImpl :: Lock -> IO ()
signalImpl lock = mask_ $ do
  conds <- takeMVar $ lockConditions lock
  let cs = conditions conds
      notifyIndex = (1 + lastNotified conds) `mod` V.length cs
      chosen = V.unsafeIndex (conditions conds) notifyIndex
  tryPutMVar chosen ()
  putMVar (lockConditions lock) (conds { lastNotified = notifyIndex })
signalImpl :: Lock -> IO ()
signalImpl lock = mask_ $ do
  conds <- takeMVar $ lockConditions lock
  let cs = conditions conds
      notifyIndex = (1 + lastNotified conds) `mod` V.length cs
      chosen = V.unsafeIndex (conditions conds) notifyIndex
  tryPutMVar chosen ()
  putMVar (lockConditions lock) (conds { lastNotified = notifyIndex })
signalImpl lock = mask_ $ do
  conds <- takeMVar $ lockConditions lock
  let cs = conditions conds
      notifyIndex = (1 + lastNotified conds) `mod` V.length cs
      chosen = V.unsafeIndex (conditions conds) notifyIndex
  tryPutMVar chosen ()
  putMVar (lockConditions lock) (conds { lastNotified = notifyIndex })