cputimeout
very unsafe way of time-outing a cpu-bounded task.
(use this crate at your own risk!)
Usage
- step 0: don't use this :)
- step 1: but if you have to...
= "*"
use timeout_cpu;
timeout_cpu.unwrap;
Nesting
state: just a PoC solution, works up to 10 nested calls
// inner smaller than outer
let r = timeout_cpu;
assert!;
// outer smaller than inner
let r = timeout_cpu;
assert!;
Allocation tracker
state: just a PoC solution, there are some corner cases.
if the task timeouts, this crate does a jmp so it may not call free() or Drop on allocated resources. If you can, allocate everything outside the function and only pass reference to it. If you can't (for example you are using a C library that calls malloc) you can use this feature. this interposes malloc calls and tracks all allocations that the task makes and calls free on them when timeouts.
just add mem-tracker to features list and everything should work.
TODO
- follow threads
- resource tracker
- tokio support
- benchmark
- tests
- documentation