Hi Michael,
It is great to see that somebody else is also
looking at this code. If you have any other questions please feel free to send
it my way.
I’ll add a bug report with this
issue to the project on SourceForge. If you want to implement it just assign it
to yourself, otherwise I’ll probably pick it up in a few days.
I think that some explanations about the
single use/multi use usage should also be added to the GApplication class. We
touched on a lot of important assumptions that should be documented.
Regards,
Tibor
From: Michael James
Meadows [mailto:[EMAIL PROTECTED]
Sent: Friday, May 05, 2006 10:36
AM
To: [EMAIL PROTECTED];
[email protected]
Subject: RE: [Alchemi-developers]
ApplicationFinish and ThreadFinish events
Hi Tibor,
Thanks very much for your reply.
"Once a single use application started there
should be no more threads added to it so there is no need to fire the
ThreadFinished event after all initial threads finished and the application
finished."
So multi-use applications equate to those applications where threads are added
dynamically or "on-the-fly". This makes sense. I have recently
changed the Tutorial_OTF and this is when I observed the peculiar behaviour
that I described. However, what has confused me is that this example creates an
application that is not
multi-use. So I was left somewhat mystified about what multi-use meant.
"So it looks like we should restrict the StartThread
call only for multi use applications. Unless there are objections to this
change I would add this to the bug list in SourceForge so we can keep track of
the change."
I agree. I observed this fault because I was incorrectly using multi-use
applications. Your suggestion will fix two problems; it will help
developers using StartThread and it will avoid the behaviour that was
observed.
"I may have misunderstood the problem you described. If
so then please send over some more details or client side code that reproduces
the problem."
I should apologise for not describing how to reproduce this behaviour. After
adding the last thread timeout to GApplication, I used Tutorial_OTF example to
test it. I changed Tutorial_OTF to include a one minute last thread timeout.
Then I added an application finish event handler and observed this strange
behaviour.
Running the latest version of Tutorial_OTF will behave as before except
that it will display "application finished" after about one minute of
the user not adding extra threads. If the user then adds extra threads then the
results from those threads will be displayed.
Comment out the following line from MultiplierApplication.Main:
ga.ApplicationFinish += new GApplicationFinish(ApplicationFinished);
Running this modified version of Tutorial_OTF will behave as before except that
it will display "application finished" after about one minute of the
user not adding extra threads. However, with this modified version, if the user
then adds extra threads then the results from those threads will not be
displayed.
I thought that it was strange that the behaviour of ThreadFinish events
should depend upon the existence of an ApplicationFinish event handler.
In summary, I didn't understand multi-use applications, incorrectly used the
alchemi framework, and observed some strange behaviour. You suggest adding an
exception to make sure that developers can only use StartThread on multi-use
applications.
Thanks again,
Michael.
= |