nlib
|
Unicode related functionality is implemented. More...
Namespaces | |
this_thread | |
Implements functions related to current thread behavior. | |
Classes | |
struct | AdoptLockType |
Used in ScopedLock and UniqueLock by tag type. More... | |
class | AsyncFileIo |
Class that wraps asynchronous file I/O. More... | |
class | AsyncFileIoService |
Class that controls asynchronous file I/O. More... | |
class | Barrier |
Synchronizes an arbitrary number of threads. More... | |
class | CondVar |
Conditional variable for synchronization. More... | |
class | CondVarForSharedCriticalSection |
A conditional variable for SharedCriticalSection and nlib_rwlock . This variable can be used in the same manner as CondVar . More... | |
class | CriticalSection |
Reentrant mutex. More... | |
struct | DeferLockType |
Used in ScopedLock and UniqueLock by tag type. More... | |
class | Future |
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 | LockFreeThreadPool |
This thread pool is suitable for deploying fine grain tasks. More... | |
class | PackagedTask |
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 | Promise |
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 | ScopedLock |
Wraps objects like CriticalSection . Locks with a constructor, and unlocks with a destructor. More... | |
class | Semaphore |
Implements a semaphore. More... | |
class | SharedCriticalSection |
Implements a read/write lock. Used when multiple threads simultaneously read data, and a single thread writes data. More... | |
class | SimpleCriticalSection |
Simplest critical section. Not reentrant. More... | |
class | Thread |
Class to create and start threads. More... | |
struct | ThreadArg |
Structure to run a thread in a Thread class. More... | |
class | ThreadPool |
Tasks may be deployed to a pool of threads that have been already created. More... | |
struct | ThreadSettings |
Class to wrap nlib_thread_attr . nlib_thread_attr_init() and nlib_thread_attr_destroy() are run automatically as required. More... | |
class | TimedCriticalSection |
Critical section that can timeout in reentrant. More... | |
class | Tls |
Class for handling thread local storage. More... | |
struct | TryToLockType |
Used in ScopedLock and UniqueLock by tag type. More... | |
class | UniqueLock |
Class to wrap objects like CriticalSection . More... | |
class | WhenFutureComplete |
Defines a Future for which to set the value, under the condition that a value has been set for the Future . More... | |
Functions | |
template<class FutureResult > | |
errno_t | GetFutureError (FutureResult &result) noexcept |
Function that enables systems to get error values when threads hold an error value. More... | |
template<class R > | |
errno_t | MakeReadyFuture (Future< R > *future, const R &value) |
Creates a Future with preset values. More... | |
size_t | GetHardwareConcurrency () noexcept |
Returns the number of hardware threads. More... | |
Async (Function With No Arguments) | |
template<class FUNC , class R > | |
errno_t | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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. | |
Variables | |
constexpr const AdoptLockType | adoptLock = {} |
An AdoptLockType -type value. | |
constexpr const TryToLockType | tryToLock = {} |
A TryToLockType -type value. | |
constexpr const DeferLockType | deferLock = {} |
A DeferLockType -type value. | |
Unicode related functionality is implemented.
nn::nlib::threading
namespace. Thread
wrapping nlib_thread
SimpleCriticalSection
, CriticalSection
, and TimedCriticalSection
all wrapping nlib_mutex
Tls
wrapping nlib_tls
CondVar
wrapping nlib_cond
Barrier
wrapping nlib_barrier
CondVarForSharedCriticalSection
wrapping nlib_rwlock
Semaphore
wrapping nlib_semaphore
ThreadPool
LockFreeThreadPool
std::future
-related classes and functions in C++11 Future
similar to std::future
in C++11 Promise
similar to std::promise
in C++11 PackagedTask
similar to std::packaged_task
in C++11 Async()
similar to std::async
in C++11 ScopedLock
similar to std::lock_guard
in C++11 UniqueLock
similar to std::unique_lock
in C++11 AsyncFileIo
and AsyncFileIoService
nn::nlib::threading::this_thread
namespace
|
inline |
Runs the function in a different thread, and makes it possible to use Future
to extract the result.
R | Type of the return value of func. |
FUNC | Type of func. |
T1 | Argument passed to func. |
[in] | future | Pointer to Future<R> . |
[in] | func | Function or function object that takes one argument. |
[in] | arg1 | Argument passed to the function. |
0 | Indicates that the thread has started to run. |
EINVAL | Indicates that future or func is NULL . |
ENOMEM | Indicates that internal memory allocation failed. |
std::async
in the C++11 standard library. A version that can configure ThreadSettings
with the last argument has also been implemented. Future
, use the following code. nn::nlib::move_tag
to the end as an argument moves the argument (implemented by a swap
member function) to reduce copies of the object.
|
inline |
Async
that moves arguments and function objects.
R | Type of the return value of func. |
FUNC | Type of func. |
T1 | Argument passed to func. |
[in] | future | Pointer to Future<R> . |
[in] | func | Function or function object that takes one argument. |
[in] | arg1 | Argument passed to the function. |
0 | Indicates that the thread has started to run. |
EINVAL | Indicates that future or func is NULL . |
ENOMEM | Indicates that internal memory allocation failed. |
const_cast
and moved (using swap
). This reduces copies of the object.
|
inline |
Runs the function in a different thread and makes it possible to extract the result according to the future.
R | Type of the return value of func. |
FUNC | Type of func. |
T1 | Argument passed to func. |
T2 | Argument passed to func. |
[in] | future | Pointer to Future<R> . |
[in] | func | Pointer to the function to run. |
[in] | arg1 | Argument passed to the function. |
[in] | arg2 | Argument passed to the function. |
0 | Indicates that the thread has started to run. |
EINVAL | Indicates that future or func is NULL . |
ENOMEM | Indicates that internal memory allocation failed. |
|
inline |
Runs the function in a different thread and makes it possible to extract the result according to the future.
R | Type of the return value of func. |
FUNC | Type of func. |
T1 | Argument passed to func. |
T2 | Argument passed to func. |
T3 | Argument passed to func. |
[in] | future | Pointer to Future<R> . |
[in] | func | Pointer to the function to run. |
[in] | arg1 | Argument passed to the function. |
[in] | arg2 | Argument passed to the function. |
[in] | arg3 | Argument passed to the function. |
0 | Indicates that the thread has started to run. |
EINVAL | Indicates that future or func is NULL . |
ENOMEM | Indicates that internal memory allocation failed. |
|
inline |
Runs the function in a different thread and makes it possible to extract the result according to the future.
R | Type of the return value of func. |
FUNC | Type of func. |
T1 | Argument passed to func. |
T2 | Argument passed to func. |
T3 | Argument passed to func. |
T4 | Argument passed to func. |
[in] | future | Pointer to Future<R> . |
[in] | func | Pointer to the function to run. |
[in] | arg1 | Argument passed to the function. |
[in] | arg2 | Argument passed to the function. |
[in] | arg3 | Argument passed to the function. |
[in] | arg4 | Argument passed to the function. |
0 | Indicates that the thread has started to run. |
EINVAL | Indicates that future or func is NULL . |
ENOMEM | Indicates that internal memory allocation failed. |
|
inline |
Runs the function in a different thread and makes it possible to extract the result according to the future.
R | Type of the return value of func. |
FUNC | Type of func. |
T1 | Argument passed to func. |
T2 | Argument passed to func. |
T3 | Argument passed to func. |
T4 | Argument passed to func. |
T5 | Argument passed to func. |
[in] | future | Pointer to Future<R> . |
[in] | func | Pointer to the function to run. |
[in] | arg1 | Argument passed to the function. |
[in] | arg2 | Argument passed to the function. |
[in] | arg3 | Argument passed to the function. |
[in] | arg4 | Argument passed to the function. |
[in] | arg5 | Argument passed to the function. |
0 | Indicates that the thread has started to run. |
EINVAL | Indicates that future or func is NULL . |
ENOMEM | Indicates that internal memory allocation failed. |
|
inlinenoexcept |
Function that enables systems to get error values when threads hold an error value.
FutureResult | Type of the value of Future in the return value of the function. |
[in,out] | result | Return value of the function. |
0
. Specialize the template to use. GetFutureError
to get the error.
|
inlinenoexcept |
|
inline |
Creates a Future
with preset values.
R | Value type of the future. |
[in,out] | future | Pointer to the Future object that sets future. |
[in] | value | The value to set. |
0 | Success. |
EINVAL | Indicates that future is NULL . |
© 2012-2016 Nintendo Co., Ltd. All rights reserved.