- Oct 30, 2000
- 42,589
- 5
- 0
Background
Building emulators for H/W that is delayed 6 months
Using shared memory and events controlling the threads using the shared memory on a Win 7 system
Single class, SharedMemory, creates memory mapped file, maps the buffer and create events.
This class is shared/used by two programs (common code). It builds the memory mapped files and events and code to trigger the events.
Each program has a "receiving thread" that uses a pulsed event when data is available in the shared memory buffer.
When I build both programs with MFC, they are able to talk with each other; raising events and passing data via the memory mapped files.
Then I rebuild one program for Win32 (eventual target is WinCE), going backward from MFC to Win32 is a bitch when having to remap control messages :\, using the same Shared Memory class - code untouched.
Now, the events raised by the MFC app are not being seen by the Win32 app.
Using the debugger, I have a breakpoint after the WaitForSingleObject call to the defined event, m_ghEventRecv. Never gets tripped on the Win32app, yet the MFC equivalent is fine.
Theories!!
Building emulators for H/W that is delayed 6 months
Using shared memory and events controlling the threads using the shared memory on a Win 7 system
Single class, SharedMemory, creates memory mapped file, maps the buffer and create events.
This class is shared/used by two programs (common code). It builds the memory mapped files and events and code to trigger the events.
Each program has a "receiving thread" that uses a pulsed event when data is available in the shared memory buffer.
When I build both programs with MFC, they are able to talk with each other; raising events and passing data via the memory mapped files.
Then I rebuild one program for Win32 (eventual target is WinCE), going backward from MFC to Win32 is a bitch when having to remap control messages :\, using the same Shared Memory class - code untouched.
Now, the events raised by the MFC app are not being seen by the Win32 app.
Using the debugger, I have a breakpoint after the WaitForSingleObject call to the defined event, m_ghEventRecv. Never gets tripped on the Win32app, yet the MFC equivalent is fine.
Theories!!
Code:
static DWORD WINAPI SPI_Thread(LPVOID lParam)
{
while (true)
{
WaitForSingleObject(mySelf->m_SharedMemory.m_ghEventRecv,INFINITE);
mySelf->OnGas_UI_Message(0,0);
}
}
Last edited:
