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).
Threading issue
Re: Threading issue
Of course you can't. You can not mix synchronization operations of Wine and native system. It won't ever work properly.jwong wrote:The problem is I cannot perform operations such as creating a new thread (using afxbeginthread()) within my Windows app or use EnterCriticalSection() and LeaveCriticalSection().
The only way you can do this is via some sort of IPC. For example stdin/stdout, pipes, socket.
Threading issue
On 4/14/11 6:47 PM, vitamin wrote:
this case.
James McKenzie
Are named pipes available through Wine? That may be the best option injwong wrote:Of course you can't. You can not mix synchronization operations of Wine and native system. It won't ever work properly.The problem is I cannot perform operations such as creating a new thread (using afxbeginthread()) within my Windows app or use EnterCriticalSection() and LeaveCriticalSection().
The only way you can do this is via some sort of IPC. For example stdin/stdout, pipes, socket.
this case.
James McKenzie
Re: Threading issue
Wine named pipes are not 100% implemented - they still don't support message mode. And are implemented via socket.James McKenzie wrote:Are named pipes available through Wine?
Re: Threading issue
Of course you can't. You can not mix synchronization operations of Wine and native system. It won't ever work properly.
I was afraid of that but thanks for the answer.