C++ Threading

03/09/2012 07:27 I don't have a username#1
Anybody got some good threading tutorials in c++?

#Edit

Using boost would be fine?
03/09/2012 09:25 Spirited#2
ANSI C++ doesn't support multithreading.
Try looking up how to approach it using Microsoft's libraries.
03/09/2012 09:40 I don't have a username#3
Quote:
Originally Posted by Fаng View Post
ANSI C++ doesn't support multithreading.
Try looking up how to approach it using Microsoft's libraries.
I'm using C::B with GNU GCC.

Been looking at boost:
[Only registered and activated users can see links. Click Here To Register...]

Also, isn't ANSI just C?
03/09/2012 13:20 tkblackbelt#4
Have a look at Qt it has a great and easy to use threading library. Qt's documentation is also very good for learning from.
03/09/2012 18:06 I don't have a username#5
Quote:
Originally Posted by tkblackbelt View Post
Have a look at Qt it has a great and easy to use threading library. Qt's documentation is also very good for learning from.
Damn Qt is great, thanks.
03/09/2012 19:13 InfamousNoone#6
There's no standard for multi-threading in C++ (or atleast I don't think there is). If your aim is cross-platform threading, I'd take a look at boost's library.
03/09/2012 20:43 Nullable#7
^That, or make the transition to C++11. Totally worth it.
03/09/2012 23:44 I don't have a username#8
Thanks everyone, taking a look :)
03/10/2012 05:40 XMasterrrr#9
as the above,

want to write in complete-native c++ use boost or C++11.

want to write with great graphical framework and libraries use QT.

if i were you i would use QT
03/10/2012 15:47 CptSky#10
I would go for Boost before Qt. Boost is more an extension to the current standard libraries than Qt. Qt is a big framework for advanced concepts like the GUI. Else, you can easily write your own threading wrapper that will be defined by the platform and using the platform API. It's what I do for file handling and unicode. (I try to make a project without any external libraries. Else, I would use boost and iconv)

All these solutions are equivalent... They are all multi-platform and they will all use the system call interface of the OS as the threading is controlled by the kernel.

N.B. Is Boost working fine? I know that some time ago, as it was compliant to new standards, you where getting bunch of errors.
03/11/2012 18:54 Mr_PoP#11
I guess C++11 will be better to use in order to make a multithreading app , it's like C# tho!

Code:
void do_work();
std::thread t(do_work);
for more info [Only registered and activated users can see links. Click Here To Register...]
03/12/2012 21:53 KraHen#12
You could also consider POSIX threads, they should be working under win32 as well, at least with Cygwin they probably do.
03/13/2012 09:35 I don't have a username#13
I will take a look, thanks everyone :)
03/24/2012 15:58 KraHen#14
I have done some testing while currently working on my C++ port of my old source, and have found that in a Win32 enviroment CreateThread works definitely better and faster than POSIX threads. This was expected though, lol. Just a notice. :) Though you shouldn`t use CreateThread, better use the C runtime version _beginthreadex(). Boost threads win hands-down.