3 ms·
If only Microsoft would make it so easy to move input handling off the main thread when writing programs for Windows. MFC was the bane of my existence starting
by blackflame7000 7y ago
If only Microsoft would make it so easy to move input handling off the main thread when writing programs for Windows. MFC was the bane of my existence starting out.
- asveikau 7y agoBe careful what you wish for. I have witnessed people in contexts like these, thinking that threads are magic performance enhancing pixie dust, and unable to reason through the subsequent bugs.
- ComputerGuru 7y agoasync/await helps with that, but like with any other abstraction, if you use it without understanding how it works and what it actually does, it’s bound to come back and bite you at some point.
- pragmatic 7y agoHow exactly? The use case for perf improvement with async/await is for IO based issues, eg instead of burning a thread waiting for IO to complete, use IO completiion ports (on winders) blah blah. If your work is CPU bound you can't async/await it away magically. Maybe I'm misunderstanding you?
- blackflame7000 7y agoYea I’m also confused. You’re main thread should be able to run completely asynchronously from worker threads. With async, you are constantly hitting a memory barrier while the worker thread completes the promise and then the main thread draws the result. Ideally, the worker thread should be able to natively queue its task for non-blocking repaints. Side note, this is why I’m a huge fan of Qt. They really did a fantastic job on building that framework for c++ to make it more safe
- ComputerGuru 7y agoI was specifically referring to input handling off the main thread, from GP’s original complaint. IO only.
- manigandham 7y agoasync/await is about non-blocking, not IO specifically. You can use async to not block the current thread while IO completes, or use it not block while while some CPU work completes (in this case on another thread while the UI is unblocked). It's similar to using an event loop architecture for all UI actions.
- pjmlp 7y agoThat had already done that back in Windows 8 introduction. You just need to code with UWP and async/await.