boost::future handles std::exception differently from std::future on Windows
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- cpp
- Domain
- operating-systems
Research direction
Start by running the provided VC++2019 Windows reproduction and compare boost::async with std::async. Trace the boost::async future path through f1.get() and the exception handling involved. Done means the boost path preserves the original std::exception::what() message, matching the shown std::async behavior.
Written by the indexing model from the issue text.
Description
I'm using VC++2019, I use boost::when_all since std::when_all is not available yet. But I find that boost::async will discard std::exception::what() and use 'Unknown exception' or 'std::exception' instead, on the other hand, std::async could handle the message as expected.
#include <iostream>
#define BOOST_THREAD_PROVIDES_FUTURE
#include <boost/thread/future.hpp>
#include <future>
int main() {
auto f1 = boost::async([]{ // the program will print 'my exception' if this line uses 'std::async'.
try{
throw std::invalid_argument("my exception");
}
catch (const std::exception& e) {
throw e;
}
});
try {
f1.get();
}
catch (const std::exception& e) {
std::cout << e.what() << std::endl;
}
}
- Dominant language
- C++
- Stars
- 213
- Forks
- 171
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from boostorg/thread
-
Difficulty 1/5 Under an hour Newbie friendliness 65/100
-
Difficulty 3/5 1-2 days Newbie friendliness 64/100
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 58/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NVIDIA/cuda-samples#453 ·