I have both a Windows app and a Cocoa Mac app. I am going to have my Windows app
run under Wine on OSX. I would like the Mac app to trigger an event in my
Windows app. I have thus far been able to accomplish this with use of the Cocoa
NSDistributedNotificationCenter.
To give a little background, my Windows app loads a winelib dll which has a
handler for a specific NSNotification and calls a function in my Windows app.
The winelib dll is passed a function pointer (for now lets call it myfunc())
during startup. Simple memory operations work great within myfunc(). I am able
to modify and view simple global variables in my Windows app such as integers (I
havent tried a C++ class). The problem is I cannot perform operations such as
creating a new thread (using afxbeginthread()) within my Windows app or use
EnterCriticalSection() and LeaveCriticalSection(). Whenever I call any of these
function the thread appears to get stuck in an infinite loop. I know a thread
has been created and hangs because the CPU usage instantly increases to roughly
70% and never decreases as soon as the handler is called.
Note: if I call myfunc() directly from within my Windows code, myfunc() operates
as expected (no hanging or increase in CPU usage).