I am working on a C++ project that uses boost 1.61, I am replacing boost with std calls, is there an alternative to boost::this_thread::interruption_point() ?
Asked
Active
Viewed 339 times
1 Answers
5
std::thread
is not interruptable. You can read more about this here. However there is std::jthread in C++-20, that you can try to use. Unfortunately, according to compiler-support list on cpp-reference, only libstdc++ 10+ supports std::jthread
.

ForEveR
- 55,233
- 2
- 119
- 133
-
Unfortunately this isn't an option I can use as I'm limited to version of C++ available. The development environment is VS2013. – SPlatten Apr 29 '20 at 11:23
-
@SPlatten, then you can either not rewrite work with thread on std, or you can attempt to use native handle and interrupt it, if there is no need in cross-platforming. – ForEveR Apr 29 '20 at 11:27
-
-
I'll give you the tick, because I don't think there is a correct answer to my particular problem but you have been very helpful. – SPlatten Apr 29 '20 at 11:42
-
A more correct answer is to use the approach to implement it yourself like in CCiA https://www.manning.com/books/c-plus-plus-concurrency-in-action-second-edition – sehe Apr 29 '20 at 16:27