I am using the following scheme to share data between multiple instances of the same application.
#pragma data_seg(".ID_DATA"
bool volatile gbID_1 = false; // In use flag for ID 1
bool volatile gbID_2 = false; // In use flag for ID 2
bool volatile gbID_3 = false; // In use flag for ID 3
bool volatile gbID_4 = false; // In use flag for ID 4
bool volatile gbKeyPressedID_1 = false; // Key pressed flag for ID 1
bool volatile gbKeyPressedID_2 = false; // Key pressed flag for ID 2
bool volatile gbKeyPressedID_3 = false; // Key pressed for ID 3 ID 1 handle
bool volatile gbKeyPressedID_4 = false; // Key pressed for ID 3 ID 1 handle
ANDLE volatile ghIDMutex = NULL; // Mutex for controlled access to this data area
#pragma data_seg()
#pragma comment(linker, "/SECTION:.ID_DATA,RWS"
I am using a Mutex (which is in this shared data - ghIDMutex )to protect this data, but could I have the main task that kicks off all these instances create the Mutex.
From what I have tried so far the Mutex is 0 in the other applications.
Any comments?
Sweep
#pragma data_seg(".ID_DATA"
bool volatile gbID_1 = false; // In use flag for ID 1
bool volatile gbID_2 = false; // In use flag for ID 2
bool volatile gbID_3 = false; // In use flag for ID 3
bool volatile gbID_4 = false; // In use flag for ID 4
bool volatile gbKeyPressedID_1 = false; // Key pressed flag for ID 1
bool volatile gbKeyPressedID_2 = false; // Key pressed flag for ID 2
bool volatile gbKeyPressedID_3 = false; // Key pressed for ID 3 ID 1 handle
bool volatile gbKeyPressedID_4 = false; // Key pressed for ID 3 ID 1 handle
ANDLE volatile ghIDMutex = NULL; // Mutex for controlled access to this data area
#pragma data_seg()
#pragma comment(linker, "/SECTION:.ID_DATA,RWS"
I am using a Mutex (which is in this shared data - ghIDMutex )to protect this data, but could I have the main task that kicks off all these instances create the Mutex.
From what I have tried so far the Mutex is 0 in the other applications.
Any comments?
Sweep