Hi,
I think I see where the problem is.
A single PNQueueReceiver may have multiple actors/threads trying to call its put() method--this is the case when there's a relation connecting the output of one actor to the input ports of multiple actors. If the size of the queue is not big enough, two threads may both block on the write and inform PNDirector that the queue is write blocked. This leads the director to believe that two different queues are blocked instead of one. Later, when the capacity of the queue is increased or a token is read and removed from it, the number of write-blocked queues is only decremented once by the director. Thus the workflow never terminates because it always thinks there's a write-blocked queue.
Here's a diff against PNQueueReceiver.java in Ptolemy II CVS that seems to fix the problem:
$ diff ~/work/ptII/ptolemy/domains/pn/kernel/PNQueueReceiver.java PNQueueReceiver.java
420,421c420,423
< _writeBlocked = true;
< prepareToBlock(branch);
---
> if (false == _writeBlocked) {
> _writeBlocked = true;
> prepareToBlock(branch);
> }
Perhaps the get() method also requires something similar. With this change, the queue only informs the director that it's blocking on write once. It seems to make the workflow I sent earlier work correctly. If you agree this patch works, then please apply to ptII CVS.
Thanks, Xiaowen
On 08.02.2005, at 19:53, xiaowen wrote:
Hi Everyone,
Attached please find a small workflow that doesn't appear to finish correctly. It is meant to write a short string to some files and immediately finish. However, it seems to stay in the "executing" state and never switches to the "execution finished" state. Will you please take a look and tell me what I'm missing?
Thanks! Xiaowen
<execute.xml>
---------------------------------------------------------------------------- Posted to the ptolemy-hackers mailing list. Please send administrative mail for this list to: [EMAIL PROTECTED]