-/* Copyright (c) 2018-2019. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2018-2020. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
Semaphore::~Semaphore()
{
if (sem_ != nullptr) {
- xbt_assert(sem_->sleeping_.empty(), "Cannot destroy semaphore since someone is still using it");
+ xbt_assert(not sem_->is_used(), "Cannot destroy semaphore since someone is still using it");
delete sem_;
}
}
kernel::actor::simcall([this] { sem_->release(); });
}
-int Semaphore::get_capacity()
+int Semaphore::get_capacity() const
{
return kernel::actor::simcall([this] { return sem_->get_capacity(); });
}
-int Semaphore::would_block()
+int Semaphore::would_block() const
{
return kernel::actor::simcall([this] { return sem_->would_block(); });
}
sem->release();
}
-int sg_sem_get_capacity(sg_sem_t sem)
+int sg_sem_get_capacity(const_sg_sem_t sem)
{
return sem->get_capacity();
}
* Note that the returned value may be wrong right after the function call, when you try to use it...
* But that's a classical semaphore issue, and SimGrid's semaphore are not different to usual ones here.
*/
-int sg_sem_would_block(sg_sem_t sem)
+int sg_sem_would_block(const_sg_sem_t sem)
{
return sem->would_block();
}