c++11 - Why std::thread doesn't have try_join_for() and interrupt() methods -
Can anyone explain to me why Here are some explanations: There is no way to request a thread ending (i.e. request that Get out of it as soon as possible and with as much grace as possible) or close a thread Forcing it to kill (i.e. kill it). We have omitted the options of But perhaps there is more complete explanation? Such methods ( Well, you answered your question to yourself. The important difference between boost and C + 11 standard is that, C + 11 is a standard, so basically everyone had to agree to the methods and functions related to the thread. But as you already told us, "such methods (try_join and interrupt) sometimes are very useful" So whether it's standard for each compiler Would it be appropriate to apply? Maybe, but if you really need it then you can only use those promoting counterparts as long as it is not included in the standard. @ Howard-Hannad suggested: There were voices on the committee, the cooperative thread can be implemented portable in C ++ not able at promotion time: Thread Was not in the middle. Therefore, Anthony Williams implemented conscience to promote large scale, because at present it was proposed as a proof of the concept that it can be implemented std :: thread to
boost :: Thread of the following:
try_join_for /
try_join_until methods
Interrupt method
std :: quick_exit () ), using the thread :: country_handle () to obtain the perception of the operating system of thread:
std :: terminate () ). All this committee could agree on this. In particular, Posx's representatives strongly criticized against any kind of 'cancellation'. However, many C ++ models of resources rely on destructors. There is no perfect solution for every system and every possible application.
try_join and
interruptions ) are sometimes very useful.
Comments
Post a Comment