Why does my simple hello world C++ app use 3 threads?
When I look in windows task manage it says it's using 3 threads? Why is this? I was expecting just 1 thread to be us开发者_如何学Ced.
I used Netbeans IDE and MinGW-Windows g++ to compile it.
Thanks
Code:
#include <iostream>
using namespace std;
int main() {
cout << "Hello World";
int input;
cin >> input;
return (EXIT_SUCCESS);
}
Maybe Netbeans put some wrapper for internal purpose ? (debugging, profilling, ...) Anyway it don't matter because you didn't create it : these threads should not interfere with your program and your program will not interfere with them.
I don't use Task Manager or Netbeans, but can I suggest you may have misread the output:
- one thread to start a shell
- one thread for the shell to execute your program
- one thread for your program's executable
Total 3. None except the last have anything to do with C++.
精彩评论