-
May 2nd, 2011, 10:28 PM
#1
MFC C++ 2005 Multithreading Help
I am a newbie in MFC C++ and I just want to ask if anyone knows where can I find a sample code application or could any one share a code of an application of Multithreading in MFC C++ 2005..
thanks in advance..
-
May 3rd, 2011, 02:53 AM
#2
Re: MFC C++ 2005 Multithreading Help
Using Worker threads
Using User-Interface Threads
and the serial communications example which uses worker and UI threads: Serial Port I/O
Victor Nijegorodov
-
May 3rd, 2011, 05:05 AM
#3
Re: MFC C++ 2005 Multithreading Help
..thank you very much VictorN..
i'll try that right away..
..thank you again..
-
May 4th, 2011, 01:25 AM
#4
Re: MFC C++ 2005 Multithreading Help
BTW, just a side note: using MFC does not oblige you to use MFC thread classes and functions exceptionally. It happens all the time in my practice that doing threads in plain Win API looks more natural to me. But this is very personal matter (of habits, preferences, skills, project requirements, coding standards, etc.), and you may find MFC stuff more appropriate/convenient for yourself.
Best regards,
Igor
-
May 4th, 2011, 02:07 AM
#5
Re: MFC C++ 2005 Multithreading Help
..thank you Igor,
its just that my boss wanted us to learn and code applications with multithreading and synchronization using MFC applications. I'll try using Win app next time . Thank you again..
-
May 4th, 2011, 07:02 AM
#6
Re: MFC C++ 2005 Multithreading Help
Hi Igor,
I've noticed this on flounder.com:
_beginthread(), _beginthreadex(), or CreateThread() in an MFC program
Is that right, and if so do you need some special approach when using the Win API for threads under MFC?
-
May 4th, 2011, 07:16 AM
#7
Re: MFC C++ 2005 Multithreading Help
Victor Nijegorodov
-
May 4th, 2011, 07:59 AM
#8
Re: MFC C++ 2005 Multithreading Help
Victor, thank you for the collection of the links. In fact talking about WinAPI threads I meant _beginthreadex and CreateThread in contrast to using AfxBeginThread. But regarding specific problem of a choice between _beginthreadex and CreateThread I'd say _beginthreadex is always appears more preferable, of course unless you're absolutely sure you know what you do with CreateThread.
Best regards,
Igor
-
May 4th, 2011, 08:04 AM
#9
Re: MFC C++ 2005 Multithreading Help
Igor, I agree!
Although I prefer using MFC CWinThread with AfxBeginThread for both worker and UI thread types.
Victor Nijegorodov
-
May 4th, 2011, 08:04 AM
#10
Re: MFC C++ 2005 Multithreading Help
Is that right, and if so do you need some special approach when using the Win API for threads under MFC?
In case you use CRT somewhere in thread, directly or indirectly, _beginthreadex is the choice. In case you're not sure if you do, _beginthreadex again is the choice. And only if you're absolutely sure you don't (i.e. you use some third party runtime or bare WinAPI), CreateThread is an option.
Best regards,
Igor
-
May 4th, 2011, 08:08 AM
#11
Re: MFC C++ 2005 Multithreading Help
Originally Posted by VictorN
Although I prefer using MFC CWinThread with AfxBeginThread for both worker and UI thread types.
Yep, exactly what I meant. Habits, preferences and other stuff...
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
|