Timer - page 6

 
Yurich:
An interruption is when OnTick is being executed and a more important event, such as OnTimer, has arrived. OnTick is paused, OnTimer code is executed, then OnTick continues to run again.
Oh dear. This is terrible dream.
 
pusheax:

OnTimer, OnTick, OnTrade... These are the interruptions.

That's what I thought at first. But there are variants. For example, we cannot mark some OnTimer with the word interrupts and know that it will be called precisely at the moment of event occurrence interrupting processing of any other events (the MSDOS single-thread scheme - store stack, handle interrupts, recover stack, pass control on). Such scheme could solve many problems using simpler methods. For example, OnTick called by this scheme looks rather nice. There are subtleties here - processing of repeated inputs will be needed (e.g. two ticks with a small gap), but it is solvable in general.
 
TheXpert:
Fucking hell. This is a bad dream.
Actually Yurich described interrupt in classic sense, not OnTick, OnTimer interrupt handling
 
For example, if someone sets Sleep(100000) in the OnTick handler; so nowOnTimer, OnTrade have no life at all?
 
TheXpert:
Bummer. Yes it's a scary dream.

No, it's not scary. There are tried and tested ancient schemes on how to avoid the bangs.

But it's still a dream. I don't believe the developers will do it. Although the benefits are undeniable.

I for example could run background calculations in OnTimer, with small frequency (about once in 5 sec) of half timer period duration. And there would be no need to worry about handling ticks, which could just interrupt the background calculation, and then correctly return it to its rightful place. And now it's easier to put it on a separate chart than to process it correctly in the same thread in which the ticks are ticking. Although there would be enough time for all of them in the same thread.

 
pusheax:
For example, if someone sets Sleep(100000); in the OnTick handler, doOnTimer and OnTrade have no life at all?

events from the timer, and new ticks will be ignored. the trade event will remain in the queue and will be handled

Do not confuse Tick, Trade, Timer events and their handlers OnTick, OnTrade, OnTimer

 
pusheax:
For example, if someone sets Sleep(100000); in OnTick handler, what willOnTimer, OnTrade have no life at all?
Right now that's exactly what it is. But suicide is not a difficult thing. It's worse, when there's a message-box on my screen, and I'm drinking tea in the kitchen. Yurich makes a good point.
 
stringo:
Actually Yurich described interrupt in classic sense, not OnTick, OnTimer interrupt handling.

I understand what he described.

To synchronize data and disrupt access in a single-threaded application is the height of idiocy.

 
MetaDriver:
That's the way it is right now. But suicide isn't difficult. It's worse when there's a message box on the screen and I'm in the kitchen drinking tea. Yurich makes a good point.
Ah, now I get it, the Timer event itself will happen but its handling OnTimer will be delayed until OnTick completes.
Документация по MQL5: Программы MQL5 / События клиентского терминала
Документация по MQL5: Программы MQL5 / События клиентского терминала
  • www.mql5.com
Программы MQL5 / События клиентского терминала - Документация по MQL5
 
pusheax:
That's probably how it works.
If only :)
Reason: