c++ - Destructor vs member function race again -


i've seen similar question: destructor vs member function race .. didn't find answer following. suppose have class owning worker thread. destructor of class can like:

~ourclass {     ask_the_thread_to_terminate;     wait_for_the_thread_to_terminate;     ....     do_other_things; } 

the question is: may call ourclass's member functions in worker thread sure these calls done before do_other_things in destructor?

yes can. destruction of member variables willonly start after do_other_things completes execution. safe call member functions before object gets destructed.


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -