I want an app to run Asynchronous but not Parallel. Like NodeJS and its event loop.
I have a simple app with a basic mostly TrayIcon UI that is mostly configured through configuration files. It’s a personal program for Windows automation, back-up, and maintaining my environment. At set intervals it does various tasks.
It doesn’t need to run fast and it’s fine if it takes a while to do its tasks. But if I’m changing configs or in the UI I do not want to experience lag. This is currently not an issue because it does its actual work via Tasks on the ThreadPool. However when it does it’s work such as scanning directories for files to backup or delete, it can use significant resources and slow the machine.
I know I can just set the process affinity, but I want it to be efficient and use as few resources as possible so I’d rather not have it spawn threads it can’t use. I’d like it to behave a little like NodeJS with setImmediate
or when it hits an await, work is schedule on a single threaded EventLoop so that execution can jump around and service other things at once as needed such as Windows Messages.
I tried something like this in past by implementing a limited concurrency ThreadPool & Task Scheduler but work was still finding it’s way onto the default ThreadPool. I’m considering redoing the app in NodeJS but figured I’d see if someone has some insight. I can’t seem to google the right terms to find a solution.
no comments yet
Be the first to share what you think!
C# devs
null reference exceptions