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
Unsigned cannot be < 0.
[simgrid.git]
/
src
/
kernel
/
activity
/
SemaphoreImpl.cpp
diff --git
a/src/kernel/activity/SemaphoreImpl.cpp
b/src/kernel/activity/SemaphoreImpl.cpp
index
3d67f8b
..
5e8016c
100644
(file)
--- a/
src/kernel/activity/SemaphoreImpl.cpp
+++ b/
src/kernel/activity/SemaphoreImpl.cpp
@@
-87,12
+87,12
@@
SemAcquisitionImplPtr SemaphoreImpl::acquire_async(actor::ActorImpl* issuer)
{
auto res = SemAcquisitionImplPtr(new kernel::activity::SemAcquisitionImpl(issuer, this), true);
{
auto res = SemAcquisitionImplPtr(new kernel::activity::SemAcquisitionImpl(issuer, this), true);
- if (value_ <= 0) {
- /* No free token in the semaphore; register the acquisition */
- ongoing_acquisitions_.push_back(res);
- } else {
+ if (value_ > 0) {
value_--;
res->granted_ = true;
value_--;
res->granted_ = true;
+ } else {
+ /* No free token in the semaphore; register the acquisition */
+ ongoing_acquisitions_.push_back(res);
}
return res;
}
}
return res;
}