A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git]
/
include
/
simgrid
/
s4u
/
mutex.hpp
diff --git
a/include/simgrid/s4u/mutex.hpp
b/include/simgrid/s4u/mutex.hpp
index
da7c3df
..
ff60143
100644
(file)
--- a/
include/simgrid/s4u/mutex.hpp
+++ b/
include/simgrid/s4u/mutex.hpp
@@
-6,6
+6,7
@@
#ifndef SIMGRID_S4U_MUTEX_HPP
#define SIMGRID_S4U_MUTEX_HPP
#ifndef SIMGRID_S4U_MUTEX_HPP
#define SIMGRID_S4U_MUTEX_HPP
+#include <mutex>
#include <utility>
#include <boost/intrusive_ptr.hpp>
#include <utility>
#include <boost/intrusive_ptr.hpp>
@@
-15,19
+16,21
@@
namespace simgrid {
namespace s4u {
namespace simgrid {
namespace s4u {
-XBT_PUBLIC_CLASS Mutex {
+class ConditionVariable;
+XBT_PUBLIC_CLASS Mutex {
+friend ConditionVariable;
public:
Mutex() :
mutex_(simcall_mutex_init()) {}
public:
Mutex() :
mutex_(simcall_mutex_init()) {}
- Mutex(simgrid::simix::Mutex* mutex) : mutex_(SIMIX_mutex_
dup
(mutex)) {}
+ Mutex(simgrid::simix::Mutex* mutex) : mutex_(SIMIX_mutex_
ref
(mutex)) {}
~Mutex()
{
~Mutex()
{
- SIMIX_mutex_
destroy
(mutex_);
+ SIMIX_mutex_
unref
(mutex_);
}
// Copy+move (with the copy-and-swap idiom):
}
// Copy+move (with the copy-and-swap idiom):
- Mutex(Mutex const& mutex) : mutex_(SIMIX_mutex_
dup
(mutex.mutex_)) {}
+ Mutex(Mutex const& mutex) : mutex_(SIMIX_mutex_
ref
(mutex.mutex_)) {}
friend void swap(Mutex& first, Mutex& second)
{
using std::swap;
friend void swap(Mutex& first, Mutex& second)
{
using std::swap;
@@
-56,6
+59,7
@@
public:
private:
simgrid::simix::Mutex* mutex_;
};
private:
simgrid::simix::Mutex* mutex_;
};
+
}} // namespace simgrid::s4u
#endif /* SIMGRID_S4U_MUTEX_HPP */
}} // namespace simgrid::s4u
#endif /* SIMGRID_S4U_MUTEX_HPP */