Skip to content

Commit c4dfbe1

Browse files
committed
Fix bug and add test for Cancel
The Cancel function was broken in multiple ways. It's fixed now, with a small test.
1 parent 5d24cc9 commit c4dfbe1

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/mpi-base.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,8 @@ function Testsome!(reqs::Array{Request,1})
456456
(indices, stats)
457457
end
458458

459-
function Cancel!(res::Request)
460-
ccall(MPI_CANCEL, Void, (Ptr{Cint},), &req.val, &0)
459+
function Cancel!(req::Request)
460+
ccall(MPI_CANCEL, Void, (Ptr{Cint},Ptr{Cint}), &req.val, &0)
461461
req.buffer = nothing
462462
nothing
463463
end

test/test_sendrecv.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,10 @@ rreq = nothing
106106
sreq = nothing
107107
gc()
108108

109+
recv_mesg = Array(Float64, N)
110+
sreq = MPI.Isend(send_mesg, dst, rank+32, comm)
111+
MPI.Cancel!(sreq)
112+
@test sreq.buffer == nothing
113+
gc()
114+
109115
MPI.Finalize()

0 commit comments

Comments
 (0)