When calling asio::async_read() using a future, is there a way to get the number of bytes transferred when a boost:asio::error::eof exception occurs? ...
When calling asio::async_read() using a future, is there a way to get the number of bytes transferred when a boost:asio::error::eof exception occurs? ...
Consider the following code: Which produces following output: As you can see, the output inside generate() function has correct (from 1 to 10) o ...
Is there any potential problem in the code snippet below if std::future::get() would not be called? I did several tests. It seems that the said code ...
I create a std::packaged_task, push it to a std::list and return its std::future to users, like this: In another thread, we may clear the tasks lis ...
I'm trying to write a fairly simple method that returns a future. A lambda sets the future. This is a minimal example. In reality the lambda might be ...
I want to do several tasks in parallel with std::async and then wait until all the futures have completed. But when executing the program i get an ...
I expect the below code to pass all assertions and complete successfully every time. Currently it seems std::future.get() blocks in both branches ever ...
I got stuck with an implementation problem in my threading practice project. I know what I want to achieve but I dont know how. I am new in the topic ...
I know that std::async is a C++11 thing but I am pretty sure that my compiler has C++11 support. and if I use Also g++ --version shows I have ...
I am using std::async and std::future for the first time and am getting the error, Can somone help me rectify it. The error: The code: ...
I got to know the reason that future returned from std::async has some special shared state through which wait on returned future happened in the dest ...
I'm in a scenario where I have many I/O-bound tasks, nicely suited to run in background. However, I can't launch all of them in parallel. Although I ...
I have a code like: If an exception is thrown in second future I will receive it only when the first future will be done. Is there a way to interru ...
I am trying to measure the duration of an API call which returns an std::future object. My current approach looks like this: However, I'm unsure ...
Is it safe (thread-safe) to declare a std::future as being mutable since its get() function changes its state. I assume that it's like std::mutex whic ...
I have a program that calculates some values in different threads with std::packaged_task<int()>. I store the std::future I get from the package ...
My question is does std::promise notify the associated std::future through using a std::condition_variable? I search the source code of std::promise ...
I have been trying to create a thread pool class(for personal experimentation/use/fun). I found a way to accept any function with any arguments/return ...
I am wrapping a C++ library to be used from .NET. There are functions in the C++ API that return std::future. I want to have the .NET proxy classes re ...
Let's say I have a method that calls an unstable third-party service, so I add a timeout for this call say 10 seconds. Here is what I tried: When c ...