Changes

Jump to: navigation, search

GPU621/NoName

342 bytes added, 19:17, 3 December 2016
Asynchronous Multi-Threading
A future is an object that can retrieve a value from some provider object (also known as a promise) or function. Simply put in the case of multithreading, a future object will wait until its associated thread has completed and then store its return value.
To retrieve or construct a future object, these functions may be used.
* Async * promise::get_future * packaged_task::get_future
However, a future object can only be used if it is in a valid state. Default future objects constructed from the std::async template function are not valid and must be assigned a valid state during execution.
A std::future references a shared state that cannot be shared to other asynchronous return objects. If multiple threads need to wait for the same shared state, std::shared_future class template should be used.
===Conclusion===
 
In conclusion while OpenMp is and still continues to be a viable option in multi-threading, it lacks the some of outlined features and lacks low-level control. While C++ 11 standard libarary multi-threading can be more difficult to learn, is supported by virtually all C++ 11 compilers and offers a low-level interaction between hardware threads.

Navigation menu