Hi,

I've managed to fix it. The problem was that sometimes, the method Object.wait(timeout) was called with timeout = 0. According to java documentation: " If timeout is zero, however, then real time is not taken into consideration and the thread simply waits until notified."

A small patch on SDFDirector.java fixed this:
=========
441c441,442
<                         _workspace.wait(this, timeToWait);
---
>                       if (timeToWait > 0)
>                               _workspace.wait(this, timeToWait);
=========

The way this part of the code is implemented is rather odd however. I wonder why there is a while(true) loop if, anyway, we are calling the wait() method. Clearly, the while loop will always run just once. I guess we could simplify the code by removing the while loop.

Cheers,

++js

JS wrote:
Hi all,

I'm currently testing the real-time possibilities of PtII. I'm running under Eclipse with a Mac Book Pro. When trying to execute the following test app, I get a strange behavior: after some time (not always the same) the application stalls. That is, I get output like:
"hello world"
"hello world"
"hello world"
"hello world"

... and then nothing. The number of iterations before it stops is not always the same.

Please tell me if you need further details or if there is something I forgot to write in my code.

Thanks,

++ js

== class SDFSimpleTest ==

import ptolemy.actor.TypedCompositeActor;
import ptolemy.kernel.util.IllegalActionException;
import ptolemy.kernel.util.NameDuplicationException;
import ptolemy.domains.sdf.kernel.SDFDirector;
import ptolemy.actor.Manager;
import ptolemy.actor.lib.StringConst;
import ptolemy.actor.lib.Writer;

public class SDFSimpleTest {

public static void main(String[] args) throws NameDuplicationException, IllegalActionException {
           TypedCompositeActor top = new TypedCompositeActor();
                     // Create the director.
           SDFDirector director = new SDFDirector(top, "director");
           director.period.setExpression("0.001");
           director.synchronizeToRealTime.setExpression("true");
           Manager manager = new Manager("manager");
           top.setManager(manager);
                     // Create two actors.
           StringConst reader = new StringConst(top, "reader");
           reader.value.setExpression("hello world");
           Writer writer = new Writer(top, "writer");
           top.connect(reader.output, writer.input);
                     top.getManager().startRun();
   }
}



--
J. S. Senécal
http://drone.ws


----------------------------------------------------------------------------
Posted to the ptolemy-hackers mailing list.  Please send administrative
mail for this list to: [EMAIL PROTECTED]

Reply via email to