Documentation for Thread
Former-commit-id: b33bbdf473792ddcde8ffbe310722d83a1a12bcf
This commit is contained in:
@@ -6,18 +6,43 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
/*!
|
||||
* \class Nz::TaskScheduler
|
||||
* \brief Core class that represents a thread pool
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief Adds a task to the pending list
|
||||
*
|
||||
* \param function Task that the pool will execute
|
||||
*/
|
||||
|
||||
template<typename F>
|
||||
void TaskScheduler::AddTask(F function)
|
||||
{
|
||||
AddTaskFunctor(new FunctorWithoutArgs<F>(function));
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Adds a task to the pending list
|
||||
*
|
||||
* \param function Task that the pool will execute
|
||||
* \param args Arguments of the function
|
||||
*/
|
||||
|
||||
template<typename F, typename... Args>
|
||||
void TaskScheduler::AddTask(F function, Args&&... args)
|
||||
{
|
||||
AddTaskFunctor(new FunctorWithArgs<F, Args...>(function, std::forward<Args>(args)...));
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Adds a task to the pending list
|
||||
*
|
||||
* \param function Task that the pool will execute
|
||||
* \param object Object on which the method will be called
|
||||
*/
|
||||
|
||||
template<typename C>
|
||||
void TaskScheduler::AddTask(void (C::*function)(), C* object)
|
||||
{
|
||||
|
||||
@@ -7,18 +7,43 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
/*!
|
||||
* \class Nz::Thread
|
||||
* \brief Core class that represents a thread
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief Constructs a Thread<T> object with a function
|
||||
*
|
||||
* \param function Task the thread will execute in parallel
|
||||
*/
|
||||
|
||||
template<typename F>
|
||||
Thread::Thread(F function)
|
||||
{
|
||||
CreateImpl(new FunctorWithoutArgs<F>(function));
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Constructs a Thread<T> object with a function and its parameters
|
||||
*
|
||||
* \param function Task the thread will execute in parallel
|
||||
* \param args Arguments of the function
|
||||
*/
|
||||
|
||||
template<typename F, typename... Args>
|
||||
Thread::Thread(F function, Args&&... args)
|
||||
{
|
||||
CreateImpl(new FunctorWithArgs<F, Args...>(function, std::forward<Args>(args)...));
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Constructs a Thread<T> object with a member function and its object
|
||||
*
|
||||
* \param function Task the thread will execute in parallel
|
||||
* \param object Object on which the method will be called
|
||||
*/
|
||||
|
||||
template<typename C>
|
||||
Thread::Thread(void (C::*function)(), C* object)
|
||||
{
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
// This file is part of the "Nazara Engine - Core module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
// Pas de header guard
|
||||
// No header guard
|
||||
|
||||
#include <Nazara/Core/LockGuard.hpp>
|
||||
#include <Nazara/Core/Mutex.hpp>
|
||||
|
||||
// Ces macros peuvent changer pour n'importe quel fichier qui l'utilise dans une même unité de compilation
|
||||
// These macroes can change for any file which uses it in the same unit of compilation
|
||||
#undef NazaraLock
|
||||
#undef NazaraMutex
|
||||
#undef NazaraMutexAttrib
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// This file is part of the "Nazara Engine - Core module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
// Pas de header guard
|
||||
// No header guard
|
||||
|
||||
// Ces macros peuvent changer pour n'importe quel fichier qui l'utilise dans une même unité de compilation
|
||||
// These macroes can change for any file which uses it in the same unit of compilation
|
||||
#undef NazaraLock
|
||||
#undef NazaraMutex
|
||||
#undef NazaraMutexAttrib
|
||||
|
||||
Reference in New Issue
Block a user