How do I do this prevention of event B through the UI and queue my events as you mention? Is there built in features for things like this in .Net?
Regarding the second solution that you mention: Doesn't putting [MethodImpl(MethodImplOptions.Synchronized)] on eventhandler A only ensure that another thread does not enter evenhandler A while the first thread is still executing it? It does not prevent a second thread to access eventhandler B before eventhandler A has finished, if I understand its documentation right? Or can I maybe have this [MethodImpl(MethodImplOptions.Synchronized)] or something alike on a block of code containing both the handlers? On 19 Feb, 11:13, Jamie Fraser <[email protected]> wrote: > Other options would be to simply prevent Event B from firing (through the > UI) until Event A is finished, use a queue system for your events, or if you > want real thread synchronisation you can put > > [MethodImpl(MethodImplOptions.Synchronized)] > > Onto the method that you need to be un-interruptable. > > > > On Sat, Feb 19, 2011 at 9:58 AM, Marcus <[email protected]> wrote: > > That is one idea, thanks for answering. > > > But I want the to handler methods to be synchronous aswell. > > That is I want the handler of event A to finish before handler of > > event B begins its execution. > > > I am not that used to thread programming, can I achieve what I need > > with threads? > > Or do I have to go another route? > > > On 19 Feb, 10:43, Jamie Fraser <[email protected]> wrote: > > > Run the code in a separate thread? > > > > On Sat, Feb 19, 2011 at 9:36 AM, Marcus <[email protected]> wrote: > > > > I need the handler code of an event A to be non interruptable by the > > > > event B > > > > > Is there some way that I can ensure that all the of the code that > > > > handles event A is executed before event B is allowed to be > > > > triggered. > > > > > I mean some way to maybe pause the reporting of events in my app until > > > > the handler code of A has executed... > > > > > ...or is there some way to mark the handler code of event A to be non- > > > > interruptible by events?- Dölj citerad text - > > > > - Visa citerad text -- Dölj citerad text - > > - Visa citerad text -
