constexpr unsigned MPI_REQ_GENERALIZED = 0x800;
constexpr unsigned MPI_REQ_COMPLETE = 0x1000;
constexpr unsigned MPI_REQ_BSEND = 0x2000;
+constexpr unsigned MPI_REQ_MATCHED = 0x4000;
+constexpr unsigned MPI_REQ_CANCELLED = 0x8000;
enum class SmpiProcessState { UNINITIALIZED, INITIALIZING, INITIALIZED /*(=MPI_Init called)*/, FINALIZED };
refcount_ = 1;
else
refcount_ = 0;
- cancelled_ = 0;
nbc_requests_=nullptr;
nbc_requests_size_=0;
init_buffer(count);
if (sender->detached_)
receiver->detached_sender_ = sender; // tie the sender to the receiver, as it is detached and has to be freed in
// the receiver
- if (req->cancelled_ == 0)
- req->cancelled_ = -1; // mark as uncancelable
+ req->flags_ |= MPI_REQ_MATCHED; // mark as impossible to cancel anymore
XBT_DEBUG("match succeeded");
return true;
}
void Request::cancel()
{
- if(cancelled_!=-1)
- cancelled_=1;
+ this->flags_ |= MPI_REQ_CANCELLED;
if (this->action_ != nullptr)
(boost::static_pointer_cast<simgrid::kernel::activity::CommImpl>(this->action_))->cancel();
}
Status::empty(status);
*flag = 1;
if (((*request)->flags_ & (MPI_REQ_PREPARED | MPI_REQ_FINISHED)) == 0) {
- if ((*request)->action_ != nullptr && (*request)->cancelled_ != 1){
+ if ((*request)->action_ != nullptr && ((*request)->flags_ & MPI_REQ_CANCELLED) == 0){
try{
*flag = simcall_comm_test((*request)->action_.get());
} catch (const Exception&) {
{
MPI_Request req = *request;
Status::empty(status);
-
- if (req->cancelled_==1){
+ if((req->flags_ & MPI_REQ_CANCELLED) != 0 && (req->flags_ & MPI_REQ_MATCHED) == 0) {
if (status!=MPI_STATUS_IGNORE)
status->cancelled=1;
if(req->detached_sender_ != nullptr)
unref(&(req->detached_sender_));
unref(request);
return;
+ } else if ((req->flags_ & MPI_REQ_CANCELLED) != 0){
+ XBT_WARN("tatatata");
}
if ((req->flags_ & (MPI_REQ_PREPARED | MPI_REQ_GENERALIZED | MPI_REQ_FINISHED)) == 0) {