Nitrogen supports some (possibly-confusingly named) functionality called continuations. A Nitrogen continuation allows you to kick off a function, and then receive a Nitrogen postback once that function has completed, where the results of the function are possed to the postback.
Additionally, Nitrogen continuations support a timeout parameter. When the timeout is exceeded, the postback fires with a result of 'timeout'.
Click the buttons below to spawn a few long running processes. (They simply sleep for a few seconds and then return.)View Module Source