C++ multithreading tutorial [closed]
Asked Answered
C

4

21

Is there a good tutorial on working with (programming) threads in Visual Studio 2005? Not MFC related, just native C++ (no .NET).

Christianly answered 10/11, 2008 at 20:11 Comment(0)
M
21

Instead of using Win32 threads directly, I'd consider using a thread wrapper such as Boost threads. These are cross platform so porting your application later will be easier.

Mccutcheon answered 10/11, 2008 at 20:39 Comment(2)
Good idea! Do you know a good tutorial about them?Benzine
yup. ddj.com/cpp/184401518Brost
D
8

You may take a look at the following OpenMP tutorials. This doesn't concern all concepts of multithreading in VC++, but OpenMP only, which VC++ supports. OpenMP is easy to use in some simple cases of multithreading, for instance independent iterations in loop, independent blocks of code which can be executed concurrently. Although OpenMP is not so flexible in comparison with other approaches but it is very easy to use.

To enable OpenMP you need to switch it on in the project properties, "C/C++/Language/OpenMP Support".

Darendaresay answered 10/11, 2008 at 20:59 Comment(1)
A big advantage of systems like OpenMp is that it is much easier to create a large number of threads to do your work, making your application scale to the multi-cores of the future.Mccutcheon
R
7

Win32 Multithreaded Programming

Also try some of the free undergraduate podcasts on operating systems. You can find theoretical discussions on locking, multithreading, etc. (the one I know of is from Berkeley and is based on Java, but it is still relevant).

Rotl answered 10/11, 2008 at 20:13 Comment(0)
R
4

Try one of these articles on The Code Project:

Recurve answered 10/11, 2008 at 20:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.