View Poll Results: What threading library do you use?
- Voters
- 13. You may not vote on this poll
-
May 23rd, 2011, 09:17 PM
#1
How do you thread?
I'm just curious. When you write multithreaded applications, how do you do the threading?
I almost invariably use POSIX. As a C programmer, I'm very familiar with it and it's available on all the platforms that my company and my personal projects care about.
-
May 23rd, 2011, 09:56 PM
#2
Re: How do you thread?
I use a pthread wrapper atm, but once Mingw gets C++1x threads working, I'll switch to that.
-
May 24th, 2011, 01:26 AM
#3
-
May 24th, 2011, 03:16 AM
#4
Re: How do you thread?
We're exclusively Windows here, so we use the Afx functions.
We make a lot of use of the WaitForMultipleObjects call, which I don't think has an exact equivalent in the other APIs.
"It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
Richard P. Feynman
-
May 24th, 2011, 04:56 AM
#5
Re: How do you thread?
We program for Windows too, but I prefer Boost.Thread over the Win API (or MFC wrappers). I find that the Windows stuff makes it too easy to develop a bad design. When you restrict yourself to the boost stuff, a good design seems to come more natural.
Originally Posted by JohnW@Wessex
We make a lot of use of the WaitForMultipleObjects call, which I don't think has an exact equivalent in the other APIs.
Boost has the wait_for_all function.
Cheers, D Drmmr
Please put [code][/code] tags around your code to preserve indentation and make it more readable.
As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky
-
May 24th, 2011, 05:20 AM
#6
Re: How do you thread?
Originally Posted by JohnW@Wessex
We're exclusively Windows here, so we use the Afx functions.
We make a lot of use of the WaitForMultipleObjects call, which I don't think has an exact equivalent in the other APIs.
Totally agree!
I use MFC and therefore its CWinThread class and AfxBeginThread to start secondary threads.
Unfortunately I cannot vote because there is no such a choice like "MFC".
Victor Nijegorodov
-
May 24th, 2011, 09:01 AM
#7
Re: How do you thread?
I have a custom thread-pool class which is built on top of Boost Threads. However, it also has a pthread-like API for use in C.
-
May 24th, 2011, 01:50 PM
#8
Re: How do you thread?
Originally Posted by VictorN
Totally agree!
I use MFC and therefore its CWinThread class and AfxBeginThread to start secondary threads.
Unfortunately I cannot vote because there is no such a choice like "MFC".
Sure you can! That's what the "other" option is for.
-
May 24th, 2011, 02:08 PM
#9
Re: How do you thread?
Originally Posted by kempofighter
Sure you can! That's what the "other" option is for.
No, MFC is absent in the list of what "other" contains...
Victor Nijegorodov
-
May 24th, 2011, 02:18 PM
#10
Re: How do you thread?
Originally Posted by VictorN
No, MFC is absent in the list of what "other" contains...
Seriously? What do you think the "...." means?
-
May 24th, 2011, 02:29 PM
#11
Re: How do you thread?
Something from
- Win API
- wxWidgets
- < ellipsis >
Victor Nijegorodov
-
May 24th, 2011, 02:41 PM
#12
Re: How do you thread?
I'm using Intel TBB (the open source version)
http://threadingbuildingblocks.org/
The emphasis is on lightweight multicore multitasking but it supports traditional heavyweight threading too.
It also features an efficient concurrent object allocator you can use to replace the standard allocator that comes with the compiler.
-
May 24th, 2011, 04:37 PM
#13
Re: How do you thread?
I code only on Windows and exclusively use _beginthreadex for thread creation.
If I code in MFC, I still use _beginthreadex instead of AfxBeginThread because I never create secondary UI threads.
I also wrap the thread sync primitives (cs, mutex, etc.) and use an auto locker class to help with thread synchronization.
Something like:
Code:
{
// Acquire the lock
AutoLock< CriticalSectionLock> lock( &m_lock );
//
// Access data
//
} // lock auto released here
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
|