Deviopath › Go

Select with Timeout

Hard · Concurrency

select waits on several channel operations. time.After(d) is a channel that receives when the duration passes. If ch does not send before timeoutMs milliseconds, return -1.

Write Wait(ch, timeoutMs). RunWait(delayMs, timeoutMs, value) is already written: it sends value after delayMs and returns what Wait got.

Next: Safe Counter