Maja
2012-06-21 07:10:21 UTC
Hi
I am making mfc regular dll that will be loaded in third-party exe. I
need to show window in which I continuously draw with DirectX. The
window will be shown as child window in one of the windows of the main
application. The drawing should take place when the application is
idle. Since I dont have source code of the main application and can't
change its main message loop so I can insert some of my drawing code ,
I came up with the following solution :
Draw on second thread. Create child window on second thread and start
message loop there, create DirectX device on the second thread with
the child window as hwnd.
Problem : I was reading around this newsgroup that I can get in
deadlock problems cause with this solution I will have parent window
which is created in main thread, and child window ( in which the
drawing will be done) in different thread. As I understand the
deadlock can happen because inter-thread SendMessage calls which are
implicit because of the parent/child relationships of my windows.
But, if I can be sure that both the message loops of the main thread
and my second thread are alive, and I don't hold any locks , I can get
away without this deadlocks problems ? or no
I am making mfc regular dll that will be loaded in third-party exe. I
need to show window in which I continuously draw with DirectX. The
window will be shown as child window in one of the windows of the main
application. The drawing should take place when the application is
idle. Since I dont have source code of the main application and can't
change its main message loop so I can insert some of my drawing code ,
I came up with the following solution :
Draw on second thread. Create child window on second thread and start
message loop there, create DirectX device on the second thread with
the child window as hwnd.
Problem : I was reading around this newsgroup that I can get in
deadlock problems cause with this solution I will have parent window
which is created in main thread, and child window ( in which the
drawing will be done) in different thread. As I understand the
deadlock can happen because inter-thread SendMessage calls which are
implicit because of the parent/child relationships of my windows.
But, if I can be sure that both the message loops of the main thread
and my second thread are alive, and I don't hold any locks , I can get
away without this deadlocks problems ? or no