Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Clojure

Idiom #185 Execute function in 30 seconds

Schedule the execution of f(42) in 30 seconds.

(do (Thread/sleep 30000)
    (f 42))

Clojure is a hosted language, and relies on host interop for things like this
using System;
using System.Threading.Tasks;
Task.Delay(TimeSpan.FromSeconds(30))
    .ContinueWith(_ => f(42));

New implementation...
< >
programming-idioms.org