Today I started working on a project where I need use thread's, I'm using functions from process.h: _beginthread and _endthread.
My question is, I really need use _endthread(); at the end of function?
void LGThread(void *null_ptr) {
/* ... code ...*/
_endthread();
}
void main() {
_beginthread(LGThread, NULL, NULL);
}
Or even with:
void LGThread(void *null_ptr) {
/* ... code ...*/
}
void main() {
_beginthread(LGThread, NULL, NULL);
}
I'm fine? What it does specially?
You don't need it. And in a C++ program it can be harmfull: It does not return, so destructors will not be called for objects allocated on the stack in the thread function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With