Runs callables with a timeout

2.0.0 2015-12-06 04:18 UTC

This package is auto-updated.

Last update: 2024-10-29 03:53:29 UTC


README

Build Status Code Coverage

API

Runs a callable until a timeout is reached:

declare(ticks = 1);

Code::run(function(){
    sleep(100);
}, 10);

Runs a callable in loop until a timeout is reached and the return value is false:

// declare(ticks = 1); is optionnal when the callable is not blocking on spinning mode

Code::spin(function(){
    sleep(1);
    return false;
}, 10);