exit

What happens to a detached thread when main() exits?

若如初见. 提交于 2019-11-26 00:51:04
问题 Assume I\'m starting a std::thread and then detach() it, so the thread continues executing even though the std::thread that once represented it, goes out of scope. Assume further that the program does not have a reliable protocol for joining the detached thread 1 , so the detached thread still runs when main() exits. I cannot find anything in the standard (more precisely, in the N3797 C++14 draft), which describes what should happen, neither 1.10 nor 30.3 contain pertinent wording. 1 Another,

What happens to a detached thread when main() exits?

徘徊边缘 提交于 2019-11-26 00:09:08
Assume I'm starting a std::thread and then detach() it, so the thread continues executing even though the std::thread that once represented it, goes out of scope. Assume further that the program does not have a reliable protocol for joining the detached thread 1 , so the detached thread still runs when main() exits. I cannot find anything in the standard (more precisely, in the N3797 C++14 draft), which describes what should happen, neither 1.10 nor 30.3 contain pertinent wording. 1 Another, probably equivalent, question is: "can a detached thread ever be joined again", because whatever

Application not quitting after calling quit

吃可爱长大的小学妹 提交于 2019-11-25 23:49:50
问题 Hey guys I have a small problem that I can\'t seem to figure out. I am saving a DataGridView (it\'s contents) to an xls file. I have no problem in doing so except in my task manager its still showing up that it\'s running. I have called: xlApp.Application.Quit() This is declared as: Dim xlApp As New excel.Application This seems to not work, BUT this is the same way I quit when I let the user choose to export it to a Word Document. Im not sure where I am going wrong... Here is my complete code

return statement vs exit() in main()

依然范特西╮ 提交于 2019-11-25 23:19:44
Should I use exit() or just return statements in main() ? Personally I favor the return statements because I feel it's like reading any other function and the flow control when I'm reading the code is smooth (in my opinion). And even if I want to refactor the main() function, having return seems like a better choice than exit() . Does exit() do anything special that return doesn't? Actually, there is a difference, but it's subtle. It has more implications for C++, but the differences are important. When I call return in main() , destructors will be called for my locally scoped objects. If I

How to exit from the application and show the home screen?

倾然丶 夕夏残阳落幕 提交于 2019-11-25 23:17:41
问题 I have an application where on the home page I have buttons for navigation through the application. On that page I have a button \"EXIT\" which when clicked should take the user to the home screen on the phone where the application icon is. How can I do that? 回答1: Android's design does not favor exiting an application by choice, but rather manages it by the OS. You can bring up the Home application by its corresponding Intent: Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory

How to stop C++ console application from exiting immediately?

孤街浪徒 提交于 2019-11-25 21:56:31
问题 Lately, I\'ve been trying to learn C++ from this website. Unfortunately whenever I try to run one of the code samples, I see that program open for about a half second and then immediately close. Is there a way to stop the program from closing immediately so that I can see the fruits of my effort? 回答1: Edit: As Charles Bailey rightly points out in a comment below, this won't work if there are characters buffered in stdin , and there's really no good way to work around that. If you're running