-/* Copyright (c) 2019. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2019-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. */
void SemaphoreImpl::acquire(actor::ActorImpl* issuer, double timeout)
{
- RawImplPtr synchro = nullptr;
-
XBT_DEBUG("Wait semaphore %p (timeout:%f)", this, timeout);
if (value_ <= 0) {
- synchro = RawImplPtr(new RawImpl());
- (*synchro).set_host(issuer->get_host()).set_timeout(timeout).start();
- synchro->simcalls_.push_front(&issuer->simcall);
- issuer->waiting_synchro = synchro;
+ RawImplPtr synchro = RawImplPtr(new RawImpl());
+ synchro->set_host(issuer->get_host()).set_timeout(timeout).start();
+ synchro->register_simcall(&issuer->simcall_);
sleeping_.push_back(*issuer);
} else {
value_--;
if (not sleeping_.empty()) {
auto& actor = sleeping_.front();
sleeping_.pop_front();
- actor.waiting_synchro = nullptr;
+ actor.waiting_synchro_ = nullptr;
actor.simcall_answer();
} else {
value_++;