Timer - page 7

 
Yurich:
if only :)
It must be easier for developers, otherwise they would have to explain that global variables can be changed in OnTick handler only halfway when timer event occurred and program switched to it.
 
Don't use MessageBox thoughtlessly.
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы ввода/вывода / MessageBox
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы ввода/вывода / MessageBox
  • www.mql5.com
Стандартные константы, перечисления и структуры / Константы ввода/вывода / MessageBox - Документация по MQL5
 
pusheax:
This is probably easier for developers, otherwise they would have to explain that global variables can only be changed halfway in the OnTick handler when a timer event has occurred and the program has switched to it.
There are short "uninterrupted blocks" for that. The interrupt waits for it to complete anyway, then aborts.
 
Yurich:
if only :)
Exactly.
 
TheXpert:
Don't use MessageBox without thinking.
That's why I had to make two threads in YuTrade to avoid skipping events. And with interrupts everything would be in one thread.
 
MetaDriver:
There are short "uninterrupted blocks" for that. The interrupt waits for it to complete in any case, then interrupts.

And I didn't know that at all, and I wrote with the assumption that an interruption might occur and the data wouldn't be fully processed.

Set flags to start and end processing.

 
Yurich:
An interruption is when OnTick is being executed and a more important event, such as OnTimer, has arrived. Execution of OnTick is paused, OnTimer code is executed and then OnTick is executed again.
All in all, you need some kind of multithreading.
 
Yurich:
And with interruptions, everything would be in the same thread.
Ah, bad argument. The way it is now -- good.
 
pusheax:

And I didn't know about it at all and wrote with the possibility that there might be an interruption and the data would not be fully processed.

I set flags to start and end processing.

Here we go. The public is already halfway there, we can safely enter.

;)

 
Interesting:
Kindergarten in general, at least some multithreading is needed.
Maybe, developers will add it sometime later: CreateThread(NULL,0,CaptureThread,0,CREATE_SUSPENDED,&ThreadId); ?