Learning threads in c++ - what lib should I focus on

Started by
4 comments, last by me22 18 years, 5 months ago
I know a little thread programming, not much I would say, but I know how it works, the difference on threads and processes, how to create, run and dealing with mutexes ... basic stuff, not anything advanced really because I have worked very little with it. I have a little experience with pthreads, doing some work on linux, and I know a bit about the win32 thread stuff. I also have been doing a bit basic thread programming in java. But when I am finished with my exams, I'm going to have a relaxing holyday, and then start thinking about programming some c++ and experimenting. I don't program much in linux, and hardly care about it. So using win32 exclusivly is actually ok for my part. But I was wondering if there is better thread libraries around, either better than win32 and/or are multiplatform. I don't have any ideas of starting to make programs that are multiplatform, but it would be nice to get used to a library that makes programming better, and if I one day would make something for another platform, then I could do so using the same knowledge instead of having to get used to yet-another-library. Something tells me that I should start learning c# and the stuff that goes with it, rather than sticking with c++. I'm just sceptical of nature. Don't like to get too know only windows ... but that is what I am practically doing.
Advertisement
I've used boost::thread, which is multiplatform. It works well enough for my limited needs.

[edit: note that this might not be the best choice, just an option]

[Edited by - Telastyn on November 23, 2005 5:16:24 PM]
You might want to look into OpenMP. VS2k5 supports it (must be the only thing with 'open' in the name that MS supports). I haven't looked into it in much details, but seemed like a nifty cross-platform way of dealing with threads and parallel processing.
Interesting, didn't thought ms would ever implement anything open ... but this is cool.

Since the new VS is free, I might download it and try it. I haven't tried the eclipse c++ ide, but the java verison is good. But I don't think eclipse supports openMP. I was looking for openMP libs, but couldn't find any .. but then again, it is late and I have to google later.

thx alot
OpenMP isn't supported by the MSVC .NET 2005 Express Edition; in order to use OpenMP you need to get Standard or better.
I'll second Boost.Threads -- At the very least it's worth a try, since you should have Boost installed anyways :P

It is more limited than many other libraries, but that isn't all bad: it keeps you to portable techniques and doesn't offer some of the most dangerous constructs. The scoped locking is also a very good practical lesson in the usefulness of RAII for things other than memory and how it's useful even if you're not using exceptions.

This topic is closed to new replies.

Advertisement