Good day.
I have a question.
Why destructors some classes:
sf::~TcpSocket, sf::~Thread
do not call methods:
sf::TcpSocke::disconnect(), sf::Thread::terminate()
?
When using them appear some discomfort, for example:
sf::Thread* thread= new sf::Thread(&fooo);
thread.launch();
...
delete thread;
The thread is still active, you have to manually call thread->terminate().
ps: And yet, it would be nice to add the processing status for threads. (sf::Thread::Status)
The thread is still active, you have to manually call thread->terminate().
No, you should not call terminate() in normal situations. sf::Thread::~Thread() invokes wait(), therefore it waits until the thread is finished. Just let your thread end regularly.
Concerning sf::TcpSocket, the base class destructor ~Socket() invokes close().
When using them appear some discomfort, for example:
sf::Thread* thread= new sf::Thread(&fooo);
thread.launch();
...
delete thread;
The discomfort here is to have new and delete, instead of adhering to RAII and using automatic variables:
sf::Thread thread(&foo);
thread.launch();
ps: And yet, it would be nice to add the processing status for threads. (sf::Thread::Status)
What is the "processing status"?