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
Rename field.
[simgrid.git]
/
src
/
s4u
/
s4u_Semaphore.cpp
diff --git
a/src/s4u/s4u_Semaphore.cpp
b/src/s4u/s4u_Semaphore.cpp
index
e38180b
..
a30ea0a
100644
(file)
--- a/
src/s4u/s4u_Semaphore.cpp
+++ b/
src/s4u/s4u_Semaphore.cpp
@@
-13,16
+13,13
@@
namespace simgrid {
namespace s4u {
namespace simgrid {
namespace s4u {
-Semaphore::Semaphore(unsigned int initial_capacity)
-{
- sem_ = new kernel::activity::SemaphoreImpl(initial_capacity);
-}
+Semaphore::Semaphore(unsigned int initial_capacity) : pimpl_(new kernel::activity::SemaphoreImpl(initial_capacity)) {}
Semaphore::~Semaphore()
{
Semaphore::~Semaphore()
{
- if (
sem
_ != nullptr) {
- xbt_assert(not
sem
_->is_used(), "Cannot destroy semaphore since someone is still using it");
- delete
sem
_;
+ if (
pimpl
_ != nullptr) {
+ xbt_assert(not
pimpl
_->is_used(), "Cannot destroy semaphore since someone is still using it");
+ delete
pimpl
_;
}
}
}
}
@@
-33,27
+30,27
@@
SemaphorePtr Semaphore::create(unsigned int initial_capacity)
void Semaphore::acquire()
{
void Semaphore::acquire()
{
- simcall_sem_acquire(
sem
_);
+ simcall_sem_acquire(
pimpl
_);
}
int Semaphore::acquire_timeout(double timeout)
{
}
int Semaphore::acquire_timeout(double timeout)
{
- return simcall_sem_acquire_timeout(
sem
_, timeout);
+ return simcall_sem_acquire_timeout(
pimpl
_, timeout);
}
void Semaphore::release()
{
}
void Semaphore::release()
{
- kernel::actor::simcall([this] {
sem
_->release(); });
+ kernel::actor::simcall([this] {
pimpl
_->release(); });
}
int Semaphore::get_capacity() const
{
}
int Semaphore::get_capacity() const
{
- return kernel::actor::simcall([this] { return
sem
_->get_capacity(); });
+ return kernel::actor::simcall([this] { return
pimpl
_->get_capacity(); });
}
int Semaphore::would_block() const
{
}
int Semaphore::would_block() const
{
- return kernel::actor::simcall([this] { return
sem
_->would_block(); });
+ return kernel::actor::simcall([this] { return
pimpl
_->would_block(); });
}
void intrusive_ptr_add_ref(Semaphore* sem)
}
void intrusive_ptr_add_ref(Semaphore* sem)