mardi 23 décembre 2014

callback at thread end

I have a std::map<std::hash<std::thread::id>>, my_struct>, and I insert std::hash<std::thread::id> of std::this_thread::get_id(), I mean, I do not create any threads, I only insert the current thread id.


I want to remove a element from the std::map, when the std:::thread associated to a std::thread::id ends.


In an old implementation, I used boost::this_thread::at_thread_exit to define a callback functor to be executed when the inserted thread ended. Is there a way to do something similar in std::thread?


TIA!


Aucun commentaire:

Enregistrer un commentaire