In which cases does program exit with 0x40010004 code?

On the theoretical side it could be anything, since TerminateProcess has an exit code parameter. On the practical side, it’s most likely due to system shutdown. When Windows shuts down, it tries to exit running programs gracefully (more on that here). If they refuse to quit, they might be terminated by the system with the exit code 0x40010004. For … Read more

Is there any way to kill a Thread?

It is generally a bad pattern to kill a thread abruptly, in Python, and in any language. Think of the following cases: the thread is holding a critical resource that must be closed properly the thread has created several other threads that must be killed as well. The nice way of handling this, if you … Read more

PHP – exit or return which is better?

Since you are using exit and return within the global scope (not inside a function), then the behavior is almost the same. The difference in this case will appear if your file is called through include() or require(). exit will terminate the program, while return will take the control back to the calling script (where include or require was called).