if they're not there .. well they are not.
if (not f2c_lookup_)
f2c_lookup_ = std::make_unique<f2c_lookup_type>();
}
- static int f2c_id() { return f2c_id_; }
+ int f2c_id() { return my_f2c_id_; }
+ static int global_f2c_id() { return f2c_id_; }
static void f2c_id_increment() { f2c_id_++; }
void mark_as_deleted() { deleted_ = true; };
virtual ~F2C() = default;
int add_f();
- static void free_f(int id) { f2c_lookup_->erase(id); }
+ static void free_f(int id) { if(id!=-1) f2c_lookup_->erase(id); }
int c2f();
// This method should be overridden in all subclasses to avoid casting the result when calling it.
if(comm->refcount_==0){
if(simgrid::smpi::F2C::lookup() != nullptr)
- F2C::free_f(comm->c2f());
+ F2C::free_f(comm->f2c_id());
comm->cleanup_smp();
comm->cleanup_attr<Comm>();
if (comm->info_ != MPI_INFO_NULL)
return;
//prevent further usage
flags_ &= ~ DT_FLAG_COMMITED;
- F2C::free_f(this->c2f());
+ F2C::free_f(this->f2c_id());
//if still used, mark for deletion
if(refcount_!=0){
flags_ |=DT_FLAG_DESTROYED;
return;
errhandler->refcount_--;
if(errhandler->refcount_==0){
- F2C::free_f(errhandler->c2f());
+ F2C::free_f(errhandler->f2c_id());
delete errhandler;
}
}
int F2C::add_f()
{
allocate_lookup();
-
- my_f2c_id_ = f2c_id();
+ my_f2c_id_ = global_f2c_id();
(*f2c_lookup_)[my_f2c_id_] = this;
f2c_id_increment();
return my_f2c_id_;
}
delete win_;
delete file_;
- F2C::free_f(this->c2f());
+ F2C::free_f(this->f2c_id());
if (info_ != MPI_INFO_NULL)
simgrid::smpi::Info::unref(info_);
if (errhandler_ != MPI_ERRHANDLER_NULL)
group->refcount_--;
if (group->refcount_ <= 0) {
if (simgrid::smpi::F2C::lookup() != nullptr)
- F2C::free_f(group->c2f());
+ F2C::free_f(group->f2c_id());
delete group;
}
}
void Info::unref(Info* info){
info->refcount_--;
if(info->refcount_==0){
- F2C::free_f(info->c2f());
+ F2C::free_f(info->f2c_id());
delete info;
}
}
if((*op)!=MPI_OP_NULL){
(*op)->refcount_--;
if ((*op)->refcount_ == 0 && not (*op)->is_predefined_){
- F2C::free_f((*op)->c2f());
+ F2C::free_f((*op)->f2c_id());
delete(*op);
}
}
Op::unref(&(*request)->op_);
(*request)->print_request("Destroying");
- F2C::free_f((*request)->c2f());
+ F2C::free_f((*request)->f2c_id());
delete *request;
*request = MPI_REQUEST_NULL;
} else {
if(allocated_ !=0)
xbt_free(base_);
- F2C::free_f(this->c2f());
+ F2C::free_f(this->f2c_id());
cleanup_attr<Win>();
}