Schedulers for asynchronous execution in a separate thread.
- Non-blocking execution
- Non-competing thread-safe execution in a single or multiple threads
- Circular buffer of tasks implementing LRU or MRU cache
- Single-threaded timer
- Batch execution with delay
Install-Package Schedule // Guaranteed execution in a single thread for thread-safe access to context variables var scheduler = new BackgroundRunner(); var x = scheduler.Send(() => Environment.CurrentManagedThreadId).Task.Result; var y = Task.Run(() => scheduler.Send(() => Environment.CurrentManagedThreadId).Task.Result).Result; Assert.Equal(x, y); // Thread-safe single-threaded timer var num = new Random(); var collection = new List<int>(); var scheduler = new LoopScheduler(); Observable.Interval(span, scheduler).Subscribe(o => collection.Add(num.Next()));Automatically calculate CPU load and spread work across cores.