We have 2 applications. One written in C# and the other in C++. We need to maintain a counter (in memory) shared between these processes. Every time one of these applications start, it needs to check for this counter and increase it and every time the application shut-down it needs to decrease the counter. If the application has a crash or shut-down using task manager, we also need the counter to decrease.  

We thought of using one of the OS synchronization objects like MUTEX.  

My question: What kind of sync object is the best for cross process (when one is C# and the other C++) 

Hope my question was clear.  

Thank you very much, 

Adi Barda