Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
IAtari
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gontier Antonin
IAtari
Commits
a12ca3d0
Commit
a12ca3d0
authored
5 years ago
by
Gontier Antonin
Browse files
Options
Downloads
Patches
Plain Diff
Ajout de la doc de SMP.h (doc non générée)
parent
961e5aa4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/SMP.h
+61
-2
61 additions, 2 deletions
src/SMP.h
with
61 additions
and
2 deletions
src/SMP.h
+
61
−
2
View file @
a12ca3d0
...
...
@@ -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*/
};
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment