CA-161590: Add helper function: timebox
CA-161590: Add helper function: timebox

It will timebox the execution of a function to x seconds. If that times out,
the "otherwise" function will be called consequently.

Signed-off-by: Zheng Li <34c6fceca75e456f25e7e99531e2425c6c1de443@zheng.li>
(cherry picked from commit 433c742cbd3f8d33ebf62e2a63ada5e5ed062994)

rafalmiel/xen-api,guard163/xen-api,simonjbeaumont/xen-api,thomassa/xen-api,salvocambria/xen-api,Frezzle/xen-api,jjd27/xen-api,djs55/xen-api,euanh/xen-api,srowe/xen-api,robertbreker/xen-api,euanh/xen-api,srowe/xen-api,rafalmiel/xen-api,agimofcarmen/xen-api,rafalmiel/xen-api,simonjbeaumont/xen-api,salvocambria/xen-api,guard163/xen-api,simonjbeaumont/xen-api,agimofcarmen/xen-api,koushikcgit/xen-api,vasilenkomike/xen-api,anoobs/xen-api,Frezzle/xen-api,jjd27/xen-api,guard163/xen-api,vasilenkomike/xen-api,srowe/xen-api,djs55/xen-api,simonjbeaumont/xen-api,robertbreker/xen-api,djs55/xen-api,jjd27/xen-api,guard163/xen-api,rafalmiel/xen-api,thomassa/xen-api,koushikcgit/xen-api,anoobs/xen-api,koushikcgit/xen-api,euanh/xen-api,robertbreker/xen-api,robertbreker/xen-api,agimofcarmen/xen-api,djs55/xen-api,anoobs/xen-api,thomassa/xen-api,salvocambria/xen-api,agimofcarmen/xen-api,Frezzle/xen-api,agimofcarmen/xen-api,vasilenkomike/xen-api,jjd27/xen-api,anoobs/xen-api,jjd27/xen-api,vasilenkomike/xen-api,robertbreker/xen-api,euanh/xen-api,thomassa/xen-api,koushikcgit/xen-api,Frezzle/xen-api,thomassa/xen-api,koushikcgit/xen-api,djs55/xen-api,vasilenkomike/xen-api,simonjbeaumont/xen-api,jjd27/xen-api,simonjbeaumont/xen-api,anoobs/xen-api,vasilenkomike/xen-api,koushikcgit/xen-api,anoobs/xen-api,Frezzle/xen-api,djs55/xen-api,guard163/xen-api,srowe/xen-api,salvocambria/xen-api,thomassa/xen-api,euanh/xen-api,euanh/xen-api,salvocambria/xen-api,salvocambria/xen-api,srowe/xen-api,agimofcarmen/xen-api,robertbreker/xen-api,rafalmiel/xen-api,rafalmiel/xen-api,guard163/xen-api