* 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. */
* 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. */
{
XBT_IN("(%p, %f)",smx_host,timeout);
{
XBT_IN("(%p, %f)",smx_host,timeout);
SIMIX_synchro_stop_waiting(simcall->issuer, simcall);
simcall->issuer->waiting_synchro = nullptr;
SIMIX_synchro_stop_waiting(simcall->issuer, simcall);
simcall->issuer->waiting_synchro = nullptr;
{
XBT_IN("(%p; %p)", this, issuer);
/* FIXME: check where to validate the arguments */
{
XBT_IN("(%p; %p)", this, issuer);
/* FIXME: check where to validate the arguments */
* \param issuer the process that tries to acquire the mutex
* \return whether we managed to lock the mutex
*/
* \param issuer the process that tries to acquire the mutex
* \return whether we managed to lock the mutex
*/
{
XBT_IN("(%p, %p)", this, issuer);
if (this->locked) {
{
XBT_IN("(%p, %p)", this, issuer);
if (this->locked) {
* If the unlocker is not the owner of the mutex nothing happens.
* If there are no process waiting, it sets the mutex as free.
*/
* If the unlocker is not the owner of the mutex nothing happens.
* If there are no process waiting, it sets the mutex as free.
*/
{
XBT_IN("(%p, %p)", this, issuer);
{
XBT_IN("(%p, %p)", this, issuer);
THROWF(mismatch_error, 0, "Cannot release that mutex: it was not locked.");
/* If the mutex is not owned by the issuer, that's not good */
if (issuer != this->owner)
THROWF(mismatch_error, 0, "Cannot release that mutex: it was not locked.");
/* If the mutex is not owned by the issuer, that's not good */
if (issuer != this->owner)
- THROWF(mismatch_error, 0, "Cannot release that mutex: it was locked by %s (pid:%ld), not by you.",
- this->owner->name.c_str(),this->owner->pid);
+ THROWF(mismatch_error, 0, "Cannot release that mutex: it was locked by %s (pid:%lu), not by you.",
+ this->owner->getCname(), this->owner->pid);
if (xbt_swag_size(this->sleeping) > 0) {
/*process to wake up */
smx_actor_t p = (smx_actor_t) xbt_swag_extract(this->sleeping);
if (xbt_swag_size(this->sleeping) > 0) {
/*process to wake up */
smx_actor_t p = (smx_actor_t) xbt_swag_extract(this->sleeping);
synchro = SIMIX_synchro_wait(issuer->host, timeout);
synchro->simcalls.push_front(simcall);
issuer->waiting_synchro = synchro;
synchro = SIMIX_synchro_wait(issuer->host, timeout);
synchro->simcalls.push_front(simcall);
issuer->waiting_synchro = synchro;
* If there are no process sleeping, no action is done.
* \param cond A condition
*/
* If there are no process sleeping, no action is done.
* \param cond A condition
*/
to make it acquire the mutex */
if ((proc = (smx_actor_t) xbt_swag_extract(cond->sleeping))) {
/* Destroy waiter's synchronization */
to make it acquire the mutex */
if ((proc = (smx_actor_t) xbt_swag_extract(cond->sleeping))) {
/* Destroy waiter's synchronization */
xbt_assert(xbt_swag_size(cond->sleeping) == 0,
"Cannot destroy conditional since someone is still using it");
xbt_swag_free(cond->sleeping);
xbt_assert(xbt_swag_size(cond->sleeping) == 0,
"Cannot destroy conditional since someone is still using it");
xbt_swag_free(cond->sleeping);
xbt_assert(xbt_swag_size(sem->sleeping) == 0,
"Cannot destroy semaphore since someone is still using it");
xbt_swag_free(sem->sleeping);
xbt_assert(xbt_swag_size(sem->sleeping) == 0,
"Cannot destroy semaphore since someone is still using it");
xbt_swag_free(sem->sleeping);
XBT_DEBUG("Sem release semaphore %p", sem);
if ((proc = (smx_actor_t) xbt_swag_extract(sem->sleeping))) {
XBT_DEBUG("Sem release semaphore %p", sem);
if ((proc = (smx_actor_t) xbt_swag_extract(sem->sleeping))) {
/** @brief Returns the current capacity of the semaphore */
int SIMIX_sem_get_capacity(smx_sem_t sem)
{
/** @brief Returns the current capacity of the semaphore */
int SIMIX_sem_get_capacity(smx_sem_t sem)
{
- _SIMIX_sem_wait(sem, timeout, simcall->issuer, simcall);
+ _SIMIX_sem_wait(sem, timeout, simcall->issuer, simcall);