Libraries: Mutex - WinAPI

 

Mutex - WinAPI:

Synchronize ОС/EA/MT processes etc. Any self-made DLLs are not needed now.

Author: o_O

 

Now it is possible to link different owls into one system without making a kuchumala :)

So you understand mutex works without semaphores?

 
Respect and respect to colleague Sergeyev for ideas and labour!
 
Urain:

So you understand mutex works without semaphores?

Nikolai, :) mutex is mutex. by itself. you can see how it is created. CreateMutex

We don't really care how the kernel associates it.

Now you can link different owls into one system without making a heap.)

If you have all expas in one code and one thread on the chart, you don't need mutexes by definition.

You need them to synchronise different threads/processes.

 
Urain:

Now it is possible to link different owls into one system without making a kuchumala :)

So you understand mutex works without semaphores?

It is a kind of semaphore.

--

Thanks Alex, it's really more relaxing to bind applications with this thing.

 

I don't understand if I need this mutex or not.

Example. I create a file in memory using File Mapping. ( https://www.mql5.com/en/code/818 )

50 bytes in size.

I run 100 Expert Advisors that work with this file in memory. All of them work like this.

while(1)
  {
   // Read from a file in memory
   // Write to a file in memory.
  }


Let 50 Expert Advisors write to the file in memory only one zero, and 50 only one one one. And writing and reading is always done at once, i.e. using only one

Read,Write functions.

If I understand this part of the description correctly:

Ибо это может привести к непредсказуемым последствиям - один процесс пишет, а второй в это же время читает и принимает некое решение и тоже обновляет эти же данные.

В этой ситуации недописанность данных первым процессом может нежелательным образом сказаться на результате решения второго и, как следствие, привести к их порче.

it is possible that there is a situation when not only zeros or ones, but a part of zeros and a part of ones can be downloaded from a file in memory. Or do I misunderstand something? Are there any disadvantages of continuous reading in a loop of the same file in memory, waiting for its change?

File Mapping без DLL
File Mapping без DLL
  • www.mql5.com
Мониторинг котировок (пример для маппинга) Пример использования DLL для работы с функциями File Mapping. В данном примере запущенный эксперт создает виртуальный файл в памяти и начинает обновлять в нем котировку символа. При запуске экспертов в других терминалах, эти эксперты открывают созданный файл и аналогично начинают обновлять свои...
 
Is it possible to write an analogue like switch on mutexes?