Use setImmediate if available.