From: Lionel Date: Thu, 6 Jun 2013 13:05:54 +0000 (+0200) Subject: Export setAsyncMailbox to Java world X-Git-Tag: v3_9_90~327 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/877dda2974b23992f11587a14b349eacd373ece4 Export setAsyncMailbox to Java world --- diff --git a/src/bindings/java/jmsg_host.c b/src/bindings/java/jmsg_host.c index 8cd7da1837..9b47427ef3 100644 --- a/src/bindings/java/jmsg_host.c +++ b/src/bindings/java/jmsg_host.c @@ -278,3 +278,12 @@ Java_org_simgrid_msg_Host_all(JNIEnv * env, jclass cls_arg) xbt_dynar_free(&table); return jtable; } + +JNIEXPORT void JNICALL +Java_org_simgrid_msg_Host_setAsyncMailbox(JNIEnv * env, jclass cls_arg, jobject jname){ + + const char *name = (*env)->GetStringUTFChars(env, jname, 0); + MSG_mailbox_set_async(name); + (*env)->ReleaseStringUTFChars(env, jname, name); + +} diff --git a/src/bindings/java/org/simgrid/msg/Host.java b/src/bindings/java/org/simgrid/msg/Host.java index c00dd54ba9..11605f93a7 100644 --- a/src/bindings/java/org/simgrid/msg/Host.java +++ b/src/bindings/java/org/simgrid/msg/Host.java @@ -101,6 +101,20 @@ public class Host { */ public native static Host[] all(); + /** + * This static method sets a mailbox to receive in asynchronous mode. + * + * All messages sent to this mailbox will be transferred to + * the receiver without waiting for the receive call. + * The receive call will still be necessary to use the received data. + * If there is a need to receive some messages asynchronously, and some not, + * two different mailboxes should be used. + * + * @param alias The name of the mailbox + */ + public static native void setAsyncMailbox(String mailboxName); + + /** * This method returns the name of a host. * @return The name of the host.