X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/640e6f6494f5e1151f6436aea0e0c515da2c144b..28523ab1e1a544f8383afa0994e80943e2168599:/src/s4u/s4u_Semaphore.cpp diff --git a/src/s4u/s4u_Semaphore.cpp b/src/s4u/s4u_Semaphore.cpp index 8476633918..7143d4faf5 100644 --- a/src/s4u/s4u_Semaphore.cpp +++ b/src/s4u/s4u_Semaphore.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2019. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2018-2021. 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. */ @@ -15,13 +15,13 @@ namespace s4u { Semaphore::Semaphore(unsigned int initial_capacity) { - sem_ = simix::simcall([initial_capacity] { return new kernel::activity::SemaphoreImpl(initial_capacity); }); + sem_ = kernel::actor::simcall([initial_capacity] { return new kernel::activity::SemaphoreImpl(initial_capacity); }); } 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_; } } @@ -43,17 +43,17 @@ int Semaphore::acquire_timeout(double timeout) void Semaphore::release() { - simix::simcall([this] { sem_->release(); }); + kernel::actor::simcall([this] { sem_->release(); }); } -int Semaphore::get_capacity() +int Semaphore::get_capacity() const { - return simix::simcall([this] { return sem_->get_capacity(); }); + return kernel::actor::simcall([this] { return sem_->get_capacity(); }); } -int Semaphore::would_block() +int Semaphore::would_block() const { - return simix::simcall([this] { return sem_->would_block(); }); + return kernel::actor::simcall([this] { return sem_->would_block(); }); } void intrusive_ptr_add_ref(Semaphore* sem) @@ -99,12 +99,12 @@ void sg_sem_release(sg_sem_t sem) 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(); } -void sg_sem_destroy(sg_sem_t sem) +void sg_sem_destroy(const_sg_sem_t sem) { delete sem; } @@ -114,7 +114,7 @@ void sg_sem_destroy(sg_sem_t sem) * 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(); }