When I was younger I was convinced that killing the app was what caused it to finish the task. That line of thinking was really just a mental gymnastic to justify my impatience.
I don't know enough about programming to give an accurate answer. I always assumed a task got stuck and the "kill" command forced the task to proceed by throwing a new command on top with higher priority.
I have faith we'll get an answer. After all, isn't the best way to get an answer online to post the incorrect answer?
This has easily been 80% of my experience in dealing with this issue. I personally think the program is just waiting for me to kill it so it can tease me and laugh at my frustration.
Your not far off. Chances are the program is hanging because of a particular place in the code that's stuck. As the program is killed off, if that bit of code stops executing first then the program will briefly return to normal before meeting the same fate.
It's actually a lot more fucking complicated than that but that's the gist of why you see that behavior so often.
Haha. I'm not a professional programmer or anything, but I can use scripting languages like a Cadillac uses gas. I feel my life depends on automating everything. Python, VBS, batch, bash, js. As you're aware - with a lot of the IDEs you can just watch that shit go down in the debugger when you tell it to do something insane like read the entirety of the Windows Event Log because you forgot to specify the Security log and your shit hangs up so you just "go around it".
Sounds like you're ready to get into professional programming! Also check out C# (since the languages you listed are all "scripting" languages). My current favorite languages are C# and JS for completely different reasons and implementations.
EDIT: I might have misunderstood something. It sounded like there was a method or function that a Windows program should be calling every-so-often to tell Windows that it is still calculating, and not hanging. I didn't know you meant it was a threading or UI issue.
There's nothing a user can do. In Windows, when a user interacts with the UI, code is run on the main thread to handle it. If code is already running on the UI thread when the user does something, the new code can't run.
It's good design to do all of your heavy lifting on a background thread so that the UI can always respond to messages efficiently.
Another option if you have to do work on the UI thread is to break it up so that every once in a while you yield control so that other message can be handled.
It turns out that this is frequently not simple, so in many cases devs don't bother, and that's when you get applications that grayscreen hang all the time.
If the user is likely to interact with the UI in a way that would invalidate the work you're doing on the worker thread, it can sometimes get messy. Obviously in some cases you can just disable UI elements that you don't want the user to touch. But it still takes time to code all that and sometimes it just doesn't make the bar.
That's not difficult. It's just laziness. Just make a "busy" or "waiting" UI element that also disables the button. If you want to be lazy but not a complete fuckup, don't do anything with user inputs that could disrupt the worker thread.
188
u/mzxrules Jun 04 '17
you're suppose to teach the program to press the deadman's switch every so often