terminate-thread-0.1.1 has been yanked.
What is this?
It's just a simple terminatable thread implement with pthread for rust
But Why?
Sometimes, I need to terminate a blocked thread. There is no way to
do it with the standard std::thread without putting into some Sync thing.
How to use it?
[]
= "0.1.0"
use Thread;
let thr = spawn;
sleep;
// Just stop it
thr.terminate
Not a good idea!
Terminate a running thread is ALWAYS A BAD IDEA!
The better way is to use something like std::sync::atomic::AtomicBool,
to give your thread a chance to return.
Tested Platform
- linux
- macos
It should work in any platform support pthread,
but the real world is sophisticated to make any promise.