Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions ompi/mpi/java/c/mpi_Request.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,18 @@ JNIEXPORT jobject JNICALL Java_mpi_Request_testStatus(
return flag ? ompi_java_status_new(env, &status) : NULL;
}

JNIEXPORT jobject JNICALL Java_mpi_Request_getStatus(
JNIEnv *env, jobject jthis, jlong handle)
{
MPI_Request req = (MPI_Request)handle;
int flag;
MPI_Status status;
int rc = MPI_Request_get_status(req, &flag, &status);
ompi_java_exceptionCheck(env, rc);
(*env)->SetLongField(env, jthis, ompi_java.ReqHandle, (jlong)req);
return flag ? ompi_java_status_new(env, &status) : NULL;
}

JNIEXPORT jboolean JNICALL Java_mpi_Request_test(
JNIEnv *env, jobject jthis, jlong handle)
{
Expand Down
17 changes: 17 additions & 0 deletions ompi/mpi/java/java/Request.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,23 @@ public final Status testStatus() throws MPIException

private native Status testStatus(long request) throws MPIException;

/**
* Returns a status object if the operation identified by the request
* is complete, or a null reference otherwise.
* <p>Java binding of the MPI operation {@code MPI_REQUEST_GET_STATUS}.
* <p>After the call, if the operation is complete (ie, if the return
* value is non-null), the request object remains active.
* @return status object
* @throws MPIException Signals that an MPI exception of some sort has occurred.
*/
public final Status getStatus() throws MPIException
{
MPI.check();
return getStatus(handle);
}

private native Status getStatus(long request) throws MPIException;

/**
* Returns true if the operation identified by the request
* is complete, or false otherwise.
Expand Down