Runs callables with a timeout

Maintainers

Package info

github.com/crysalead/code

pkg:composer/crysalead/code

Statistics

Installs: 7 375

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

2.0.0 2015-12-06 04:18 UTC

This package is auto-updated.

Last update: 2026-03-01 00:21:31 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);