Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have an Win32 app that contains 13 SetTimer() calls... I have a doubt: to optimize application performance, would be better to use CreateThread (with infinite loop and Sleep) instead SetTimer? Which of the two ways to a better way and timing of actions?
Sorry for bad english, thanks in advance!
I wouldn't write a custom timer unless you have a very specific need to do so. I'd guess performance difference would be negligible for most applications. Plus you'll run into other issues I'm sure you're not currently considering, like data synchronization, communicating with your GUI thread for user interactions, etc. It's possible you could even make performance worse.
If you feel you have a specific need, state what that need is and maybe we can guide the answer.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
All in title. Since coroutine just need a sort of EIP memory, and thread provides that, is it possible to do it? That's way to have a highly portable coroutine library.
You can implement coroutines / generators based on threads or even fibers. But they would be less performant compared to implementations like msvc or gcc provide.
I implemented coroutines that way (no threads, but fibers) in delphi. You need to estimate how much stack-memory do you need, you need to create those threads (which is heavy...).
So you should avoid that.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
A lot of WinAPI objects, such as handles, events or sockets, are resources. I found it safe and efficient to wrap them in RAII classes.
Are there any pitfalls in doing that? Is it common practice or, instead, a bright, misleading idea? Or, maybe, there are already libraries for that? (Although I couldn't find anything worthy.)
Mostly, I'm interested in wrappers for 'small' objects like files, sockets, events and threads, that are not related to GUI or COM. Libraries like MFC or ATL may do such job but don't seem to be lightweight and no-overhead what I'm asking about.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
(Please note this is my first question so apologies on rule-breaking just let me know and I'll fix it)
I'm attempting to write a cancel operation for a software download application. This application will first transfer the software to the device and then install the software on it. (These are givens I'm not allowed to change).
What should the cancel operation do? When a user presses 'cancel', the application should stop transferring/installing the software immediately.
Question: Since I've never written a "cancel" function, I'm wondering what are the types of things to consider when writing the code, and what are the common bugs I should expect and how to deal with them?
Couldn't find anything in google so if you have some links that would be good reads I'd really appreciate it since I'm not looking for answers I'm just looking for guidelines/macro/concept help
It depends on your requirements, but usually in a cancel operation you will keep a stack of the operations that have been performed so that you can go back and undo them all when cancel is clicked.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
My task is to make a program, which counts a time of running processes in windows. Can you suggest me how or from where can I catch that informations?
For list of currently running processes under Windows use EnumProcesses win32 API
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682629%28v=vs.85%29.aspx
example how to do this:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682623%28v=vs.85%29.aspx
From your question I'm not sure if you need process timing information (CPU time,etc.) or to count instances of given process in memory. Could you please explain this more clearly ?
You can use GetProcessTimes function to get process timing information.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Is that possible to create a low level framework similar to OpenGL?
What do you need to building such API?
No, implementing something like OpenGL is not possible. Since the time OpenGL has decended from the heavens complete, writing something like it was forbidden by all common religions.
But really, what you'll actually need is about 21 years of work, a few thousands of developers and broad support from all industry leaders, so yea, piece of cake.
Or actually, all you need is just a notepad and a pencil, writing is easy!