-
September 30th, 2011, 10:57 AM
#1
Accessing MFC-Objects from other threads than the primary
I'm using a graphics library within an application. Functions of the library were accessed from a different than the application's primary thread. There were crashes which could be traced back to the said library. The developer told me that there are problems when functions are called from other threads. That's not my problem at this point - But: Are there any general restrictions for MFC- or Win32-Objects when being accessed from other that the main thread? If there are any, is there a good source for retrieving further information?
Thanks for any support in advance!
-
September 30th, 2011, 11:07 AM
#2
Re: Accessing MFC-Objects from other threads than the primary
Victor Nijegorodov
-
September 30th, 2011, 02:03 PM
#3
Re: Accessing MFC-Objects from other threads than the primary
Are there any general restrictions for MFC- or Win32-Objects when being accessed from other that the main thread?
For MFC window objects, yes there is. And no there's not for Win32 objects. MFC window object is restricted to be used only in the thread it was created in, and therefore must not be called across threads. However, window handle wrapped by the MFC object can be used across threads without any limitation.
Best regards,
Igor
-
September 30th, 2011, 02:25 PM
#4
Re: Accessing MFC-Objects from other threads than the primary
Originally Posted by Igor Vartanov
... However, window handle wrapped by the MFC object can be used across threads without any limitation.
... however, sending messages (SendMessage) to some HWND belonging to another thread may cause a deadlock.
Victor Nijegorodov
-
September 30th, 2011, 05:00 PM
#5
Re: Accessing MFC-Objects from other threads than the primary
Sure, but this is not a limitation. Just a very specific case.
Best regards,
Igor
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|