2 stable releases

1.1.0 Aug 18, 2024
1.0.0 Jan 24, 2024

#549 in Data structures

Download history 101/week @ 2024-08-13 18/week @ 2024-08-20 12/week @ 2024-09-10 9/week @ 2024-09-17 18/week @ 2024-09-24 33/week @ 2024-10-01 2/week @ 2024-10-08

68 downloads per month
Used in htrace

MIT/Apache

9KB
162 lines

SingletonThread

A library using a FnMut you defined and run it on a thread that follow a singleton pattern :

  • At any time, only one instance of the thread can be run.
  • to run again, the FnMut must have finished

Some tool allow you to define how you want to rerun the thread :

  • setDuration() or setDuration_FPS() : define a minimum time between to run. (default 17ms / 60fps)
  • thread_launch() : try to rerun the thread, do nothing if the thread is already running
  • setLoop() : loop the thread

Online Documentation

Master branch

Example

You can check the test as example, here : https://github.com/hyultis/singletonThread/blob/master/tests/tests.rs

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 licence, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~0.6–5MB
~16K SLoC