运行带超时的可调用对象

2.0.0 2015-12-06 04:18 UTC

This package is auto-updated.

Last update: 2024-08-29 03:18:32 UTC


README

Build Status Code Coverage

API

运行可调用对象直到达到超时

declare(ticks = 1);

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

循环运行可调用对象直到达到超时且返回值是false

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

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