Re: File browser



On Wed, 06 Feb 2008 09:24:42 -0800, Nigel Wade <nmw@xxxxxxxxxxxx> wrote:

[...]
I can easily write code that will consistently produce wrong results with
incorrect synchronization. It's true that one can get lucky and have it
work without. But it's also true that it's relatively simple to force a
problem in order to demonstrate the risk of failing to synchronize.

Yes, but to do that you need to be in control of the competing threads. With the EDT you are not.

Sure, you are. Any time you get your code to be called on the EDT, you are now in control. Until your code returns, you remain in control.

So it should be simple enough to write code that intentionally causes something to be called on the EDT, at which point one can take advantage of that control to ensure a synchronization error.

One of the previously-cited articles does in fact do something like this. Unfortunately, because it's specifically using invokeLater() to get code to execute on the EDT, it's not a demonstration of the problem I'm asking about. It does reliably demonstrate the potential for a problem that could occur when your own code intentially puts something for execution on the EDT, but it doesn't help me better understand how someone could unintentionally have something execute on the EDT prior to any components being visible.

[...]
The EDT is event driven, events which are affected by user actions and the
exact timing of those actions, plus other factors external to your application
which are handled by the OS.

Before any components are shown, user actions won't affect when things are executed on the EDT. So, what of those "factors external to your application"? What factors exist during initialization, prior to any components being shown, that might cause something to happen on the EDT?

I should reiterate that none of my questions are intended to suggest that the advice given is wrong. They are only intended to solicit more information that would help me understand better what the specific risks are.

Remember: "I don't know" is an acceptable answer. I just don't appreciate the attitude conveyed to me that _I_ don't need to know.

Thanks,
Pete
.



Relevant Pages

  • Re: Controling Event Sequencing...
    ... the framework will post a message to the message queue ... does not execute after the event is fired.... ... control exposes this event to the programmer to allow him / her to ... these system / control events will immidiately fire after the ...
    (microsoft.public.dotnet.languages.vb)
  • Re: More Before-The-Fact-Isms II, blocking viruses and spyware through NTFS
    ... > BUILTIN\Administrators Full Control ... > BUILTIN\CREATOR OWNER Special (Full Control except Execute) for Files ... but still can't launch any executables. ...
    (microsoft.public.security)
  • Re: Controling Event Sequencing...
    ... need the OnPostClick event fire after the OnClick event is completely ... event queue and have it execute AFTER the OnClick in completely done ... ... control exposes this event to the programmer to allow him / her to ... I inherit from this and create another button... ...
    (microsoft.public.dotnet.languages.vb)
  • Re: File browser
    ... but to do that you need to be in control of the competing threads. ... The outdated guidance that you could initialize the GUI on the main thread, ... of that control to ensure a synchronization error. ...
    (comp.lang.java.programmer)
  • Re: Javascript Server-side Action Questions..
    ... How do you set the values from server-side to a client-side ... control or how do you execute a javascript function without a button click ... What ever asp.net control post back to your server even handler add ... there you can write your checkbox selection logic. ...
    (microsoft.public.dotnet.framework.aspnet)