I've to share memory between two applications. I readed several documents about it an I find that I've to use a mutex (semaphore) to see if the shared memory is in use or not.
I wonder if I can create a structure for example:
Code:
struct
{
char data[..];
bool semaphore;
} shared_data;
where I set/clear semaphore variable to see if is in use or not.

I find it much more simple than using the system semphores...

Does someone can explain me if and why is better to use system semaphores and in the case, why the approach i described is not good?

thx
Lollo