Skip to content
Snippets Groups Projects
Commit a12ca3d0 authored by Gontier Antonin's avatar Gontier Antonin :fox:
Browse files

Ajout de la doc de SMP.h (doc non générée)

parent 961e5aa4
No related branches found
No related tags found
No related merge requests found
......@@ -21,26 +21,85 @@
#include <atomic>
/**
* @namespace SMP
* @brief A Symmetric multiprocessing implementation
*
*/
namespace SMP {
/**
* @fn get_num_cpus
* @brief Returns the number of hardware thread contexts. This value is supposed to be equals to the number of cores of the machine.
*
* @return The number of hardware thread contexts
*/
int get_num_cpus();
/**
* @class Mutex
* @brief Class used to protect data shared with different threads.
*
* @copyright GNU General Public License
* @copyright Part of Leela Zero software
* @author Gian-Carlo Pascutto
*/
class Mutex {
public:
/**
* @fn Mutex
* @brief Standard constructor (Set the Mutex as unlocked)
*
*/
Mutex();
/**
* @fn ~Mutex
* @brief Standard destructor
*
*/
~Mutex() = default;
friend class Lock;
private:
std::atomic<bool> m_lock;
std::atomic<bool> m_lock; /**< Boolean representing the locking state of the Mutex */
};
/**
* @class Lock
* @brief Class used to handle Mutex
*
* @copyright GNU General Public License
* @copyright Part of Leela Zero software
* @author Gian-Carlo Pascutto
*/
class Lock {
public:
/**
* @fn Lock
* @brief Construct a Lock with a Mutex
*
* @param[in] m
*/
explicit Lock(Mutex & m);
/**
* @fn ~Lock
* @brief Standard destructor
*
*/
~Lock();
/**
* @fn lock
* @brief Try to lock the Mutex
*
*/
void lock();
/**
* @fn unlock
* @brief Unlock the Mutex
*
*/
void unlock();
private:
Mutex * m_mutex;
Mutex * m_mutex; /**< The associated mutex*/
};
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment