nlib
Future.h File Reference

Implements the Future pattern for multithread programming. More...

#include "nn/nlib/Swap.h"
#include "nn/nlib/UniquePtr.h"
#include "nn/nlib/DateTime.h"
#include "nn/nlib/TypeTraits.h"
#include "nn/nlib/threading/CriticalSection.h"
#include "nn/nlib/threading/LimitedSharedPtr.h"
#include "nn/nlib/threading/Thread.h"

Go to the source code of this file.

Classes

class  nn::nlib::threading::Future< R >
 Class that gets the output of a different thread executing in a thread safe manner. This class is similar to the std::shared_future class of C++11. More...
 
class  nn::nlib::threading::Promise< R >
 Class that calls the result of thread execution and outputs it in a thread safe manner. This class is similar to the std::promise class of C++11. More...
 
class  nn::nlib::threading::Promise< R >
 Class that calls the result of thread execution and outputs it in a thread safe manner. This class is similar to the std::promise class of C++11. More...
 
class  nn::nlib::threading::Future< R >
 Class that gets the output of a different thread executing in a thread safe manner. This class is similar to the std::shared_future class of C++11. More...
 
class  nn::nlib::threading::PackagedTask< T >
 Class that wraps a function to run in a different thread, and gets the return value in a thread safe manner. This class is similar to the std::packaged_task class of C++11. More...
 
class  nn::nlib::threading::WhenFutureComplete< R1, R2, R3, R4, R5 >
 Defines a Future for which to set the value, under the condition that a value has been set for the Future. More...
 

Namespaces

 nn::nlib
 Implements stream-related classes usually commonly used, various containers, and other gadget classes. nlib_ns is an alias.
 
 nn::nlib::threading
 Unicode related functionality is implemented.
 

Functions

template<class FutureResult >
errno_t nn::nlib::threading::GetFutureError (FutureResult &result) noexcept
 Function that enables systems to get error values when threads hold an error value. More...
 
template<class R >
errno_t nn::nlib::threading::MakeReadyFuture (Future< R > *future, const R &value)
 Creates a Future with preset values. More...
 
Async (Function With No Arguments)
template<class FUNC , class R >
errno_t nn::nlib::threading::Async (Future< R > *future, const FUNC &func, const ThreadSettings &settings)
 Async that allows the user to configure the start of the thread.
 
template<class FUNC , class R >
errno_t nn::nlib::threading::Async (Future< R > *future, const FUNC &func, const ThreadSettings &settings, move_tag)
 Async where the user may configure the thread start, and where arguments and the function object are moved.
 
template<class FUNC , class R >
errno_t nn::nlib::threading::Async (Future< R > *future, const FUNC &func)
 Runs the function in a different thread, and makes it possible to use Future to extract the result.
 
template<class FUNC , class R >
errno_t nn::nlib::threading::Async (Future< R > *future, const FUNC &func, move_tag)
 Async that moves arguments and function objects.
 
Async (Function With One Argument)
template<class FUNC , class R , class T1 >
errno_t nn::nlib::threading::Async (Future< R > *future, const FUNC &func, const T1 &arg1, const ThreadSettings &settings)
 Async that allows the user to configure the start of the thread.
 
template<class FUNC , class R , class T1 >
errno_t nn::nlib::threading::Async (Future< R > *future, const FUNC &func, const T1 &arg1, const ThreadSettings &settings, move_tag)
 Async where the user may configure the thread start, and where arguments and the function object are moved.
 
template<class FUNC , class R , class T1 >
errno_t nn::nlib::threading::Async (Future< R > *future, const FUNC &func, const T1 &arg1)
 Runs the function in a different thread, and makes it possible to use Future to extract the result. More...
 
template<class FUNC , class R , class T1 >
errno_t nn::nlib::threading::Async (Future< R > *future, const FUNC &func, const T1 &arg1, move_tag)
 Async that moves arguments and function objects. More...
 
Async (Function With Two Arguments)
template<class FUNC , class R , class T1 , class T2 >
errno_t nn::nlib::threading::Async (Future< R > *future, const FUNC &func, const T1 &arg1, const T2 &arg2, const ThreadSettings &settings)
 Async that allows the user to configure the start of the thread.
 
template<class FUNC , class R , class T1 , class T2 >
errno_t nn::nlib::threading::Async (Future< R > *future, const FUNC &func, const T1 &arg1, const T2 &arg2, const ThreadSettings &settings, move_tag)
 Async where the user may configure the thread start, and where arguments and the function object are moved.
 
template<class FUNC , class R , class T1 , class T2 >
errno_t nn::nlib::threading::Async (Future< R > *future, const FUNC &func, const T1 &arg1, const T2 &arg2)
 Runs the function in a different thread and makes it possible to extract the result according to the future. More...
 
template<class FUNC , class R , class T1 , class T2 >
errno_t nn::nlib::threading::Async (Future< R > *future, const FUNC &func, const T1 &arg1, const T2 &arg2, move_tag)
 Async that moves arguments and function objects.
 
Async (Function With Three Arguments)
template<class FUNC , class R , class T1 , class T2 , class T3 >
errno_t nn::nlib::threading::Async (Future< R > *future, const FUNC &func, const T1 &arg1, const T2 &arg2, const T3 &arg3, const ThreadSettings &settings)
 Async that allows the user to configure the start of the thread.
 
template<class FUNC , class R , class T1 , class T2 , class T3 >
errno_t nn::nlib::threading::Async (Future< R > *future, const FUNC &func, const T1 &arg1, const T2 &arg2, const T3 &arg3, const ThreadSettings &settings, move_tag)
 Async where the user may configure the thread start, and where arguments and the function object are moved.
 
template<class FUNC , class R , class T1 , class T2 , class T3 >
errno_t nn::nlib::threading::Async (Future< R > *future, const FUNC &func, const T1 &arg1, const T2 &arg2, const T3 &arg3)
 Runs the function in a different thread and makes it possible to extract the result according to the future. More...
 
template<class FUNC , class R , class T1 , class T2 , class T3 >
errno_t nn::nlib::threading::Async (Future< R > *future, const FUNC &func, const T1 &arg1, const T2 &arg2, const T3 &arg3, move_tag)
 Async that moves arguments and function objects.
 
Async (Function With Four Arguments)
template<class FUNC , class R , class T1 , class T2 , class T3 , class T4 >
errno_t nn::nlib::threading::Async (Future< R > *future, const FUNC &func, const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const ThreadSettings &settings)
 Async that allows the user to configure the start of the thread.
 
template<class FUNC , class R , class T1 , class T2 , class T3 , class T4 >
errno_t nn::nlib::threading::Async (Future< R > *future, const FUNC &func, const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const ThreadSettings &settings, move_tag)
 Async where the user may configure the thread start, and where arguments and the function object are moved.
 
template<class FUNC , class R , class T1 , class T2 , class T3 , class T4 >
errno_t nn::nlib::threading::Async (Future< R > *future, const FUNC &func, const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4)
 Runs the function in a different thread and makes it possible to extract the result according to the future. More...
 
template<class FUNC , class R , class T1 , class T2 , class T3 , class T4 >
errno_t nn::nlib::threading::Async (Future< R > *future, const FUNC &func, const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, move_tag)
 Async that moves arguments and function objects.
 
Async (Function With Five Arguments)
template<class FUNC , class R , class T1 , class T2 , class T3 , class T4 , class T5 >
errno_t nn::nlib::threading::Async (Future< R > *future, const FUNC &func, const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const T5 &arg5, const ThreadSettings &settings)
 Async that allows the user to configure the start of the thread.
 
template<class FUNC , class R , class T1 , class T2 , class T3 , class T4 , class T5 >
errno_t nn::nlib::threading::Async (Future< R > *future, const FUNC &func, const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const T5 &arg5, const ThreadSettings &settings, move_tag)
 Async where the user may configure the thread start, and where arguments and the function object are moved.
 
template<class FUNC , class R , class T1 , class T2 , class T3 , class T4 , class T5 >
errno_t nn::nlib::threading::Async (Future< R > *future, const FUNC &func, const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const T5 &arg5)
 Runs the function in a different thread and makes it possible to extract the result according to the future. More...
 
template<class FUNC , class R , class T1 , class T2 , class T3 , class T4 , class T5 >
errno_t nn::nlib::threading::Async (Future< R > *future, const FUNC &func, const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const T5 &arg5, move_tag)
 Async that moves arguments and function objects.
 

Detailed Description

Implements the Future pattern for multithread programming.

Definition in file Future.h.