Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add isend in Task
[simgrid.git] / org / simgrid / msg / Task.java
index c151961..a680e64 100644 (file)
@@ -68,45 +68,39 @@ public class Task {
      * @return
      */
        public String getName() {
-               Process.ifInterruptedStop();
                return MsgNative.taskGetName(this);
        }
        /** Gets the sender of the task */ 
        Process getSender() {
-               Process.ifInterruptedStop();
                return MsgNative.taskGetSender(this);
        }
     /** Gets the source of the task
      * @return
      */
        public Host getSource()  {
-               Process.ifInterruptedStop();
                return MsgNative.taskGetSource(this);
        }
     /** Gets the computing amount of the task
      * @return
      */
        public double getComputeDuration() {
-               Process.ifInterruptedStop();
                return MsgNative.taskGetComputeDuration(this);
        }
     /** Gets the remaining computation of the task
      * @return
      */
        public double getRemainingDuration() {
-               Process.ifInterruptedStop();
                return MsgNative.taskGetRemainingDuration(this);
        }
        /**
         * This method sets the priority of the computation of the task.
-        * The priority doesn't affect the transfert rate. For example a
+        * The priority doesn't affect the transfer rate. For example a
         * priority of 2 will make the task receive two times more cpu than
         * the other ones.
         *
         * @param priority      The new priority of the task.
         */ 
        public void setPriority(double priority) {
-               Process.ifInterruptedStop();
                MsgNative.taskSetPriority(this, priority);
        }
        /* *                       * *
@@ -125,7 +119,6 @@ public class Task {
      * @throws TaskCancelledException
      */
        public void execute() throws HostFailureException,TaskCancelledException {
-               Process.ifInterruptedStop();
                MsgNative.taskExecute(this);
        }
        /**
@@ -133,7 +126,6 @@ public class Task {
         *
         */ 
        public void cancel()  {
-               Process.ifInterruptedStop();
                MsgNative.taskCancel(this);
        }
        /** Deletes a task.
@@ -141,11 +133,19 @@ public class Task {
         * @exception                   NativeException if the destruction failed.
         */ 
        protected void finalize() throws NativeException {
-               Process.ifInterruptedStop();
                if (this.bind != 0)
                        MsgNative.taskDestroy(this);
        }
 
+
+       /** Send the task asynchronously on the mailbox identified by the specified name, 
+        *  with no way to retrieve whether the communication succeeded or not
+        * 
+        */
+       public void dsend(String mailbox) {
+               MsgNative.taskDSend(mailbox, this);
+       } 
+       
        /**
         * Sends the task on the mailbox identified by the specified name 
         *
@@ -155,7 +155,6 @@ public class Task {
         * @throws TransferFailureException 
         */
        public void send(String mailbox) throws TransferFailureException, HostFailureException, TimeoutException {
-               Process.ifInterruptedStop();
                MsgNative.taskSend(mailbox, this, -1);
        } 
 
@@ -170,7 +169,6 @@ public class Task {
         * @throws TransferFailureException 
         */
        public void send(String mailbox, double timeout) throws NativeException, TransferFailureException, HostFailureException, TimeoutException {
-               Process.ifInterruptedStop();
                MsgNative.taskSend(mailbox, this, timeout);
        } 
 
@@ -184,10 +182,19 @@ public class Task {
      * @throws TimeoutException
         */
        public void sendBounded(String alias, double maxrate) throws TransferFailureException, HostFailureException, TimeoutException {
-               Process.ifInterruptedStop();
                MsgNative.taskSendBounded(alias, this, maxrate);
        } 
-
+       /**
+        * Sends the task on the mailbox asynchronously
+        */
+       public native Comm isend(String mailbox);
+       
+       /**
+        * Starts listening for receiving a task from an asynchronous communication
+        * @param mailbox
+        * @return
+        */
+       public static native Comm irecv(String mailbox);
        /**
         * Retrieves next task from the mailbox identified by the specified name
         *
@@ -199,7 +206,6 @@ public class Task {
         */
 
        public static Task receive(String mailbox) throws TransferFailureException, HostFailureException, TimeoutException {
-               Process.ifInterruptedStop();
                return MsgNative.taskReceive(mailbox, -1.0, null);
        }
 
@@ -214,7 +220,6 @@ public class Task {
      * @throws TimeoutException
         */
        public static Task receive(String mailbox, double timeout) throws  TransferFailureException, HostFailureException, TimeoutException {
-               Process.ifInterruptedStop();
                return MsgNative.taskReceive(mailbox, timeout, null);
        }
 
@@ -230,7 +235,6 @@ public class Task {
         */
 
        public static Task receive(String mailbox, Host host) throws TransferFailureException, HostFailureException, TimeoutException {
-               Process.ifInterruptedStop();
                return MsgNative.taskReceive(mailbox, -1.0, host);
        }
 
@@ -246,7 +250,6 @@ public class Task {
      * @throws TimeoutException
         */
        public static Task receive(String mailbox, double timeout, Host host) throws TransferFailureException, HostFailureException, TimeoutException {
-               Process.ifInterruptedStop();
                return MsgNative.taskReceive(mailbox, timeout, host);
        }
 
@@ -258,7 +261,6 @@ public class Task {
      * @return
      */
        public static int listenFrom(String mailbox)  {
-               Process.ifInterruptedStop();
                return MsgNative.taskListenFrom(mailbox);
        }
        /**
@@ -269,7 +271,6 @@ public class Task {
      * @return
      */
        public static boolean listen(String mailbox)   {
-               Process.ifInterruptedStop();
                return MsgNative.taskListen(mailbox);
        }
 
@@ -282,7 +283,6 @@ public class Task {
      * @return
      */
        public static int listenFromHost(String alias, Host host)   {
-               Process.ifInterruptedStop();
                return MsgNative.taskListenFromHost(alias, host);
        }
 }