News for hackers. Stuff that matters.
Re:Multithreading in modern C++ by jwilk on Thursday April 28, 2016 @09:38AM (#11588696)
Am I missing something, or is this article virtually content-free?
Re:Multithreading in modern C++ by coherentpony on Thursday April 28, 2016 @10:58AM (#11589326)
You are not missing anything.
Re:Multithreading in modern C++ by cbsmith on Thursday April 28, 2016 @11:08AM (#11589403)
Wait, the domain is called "modernescpp.com", that's Moderns Cpp... not Modern Cpp.

Wow, that's not good....

Re:Multithreading in modern C++ by Certhas on Thursday April 28, 2016 @11:18AM (#11589485)
That's intentional as it is a translation of a German blog:

> Because the roots of my blogs are in German, I will continue to call him Modernes C++. That is not by mistake.

http://www.modernescpp.com/index.php/warum-einen-blog-zu-mod...

Not saying it's a good decision...

Re:Multithreading in modern C++ by cbsmith on Thursday May 05, 2016 @05:18AM (#11634775)
I'd would say that even in German, the brand was pretty well established: http://www.amazon.de/Modernes-Design-Programmierung-Entwurfs...
Re:Multithreading in modern C++ by capote on Thursday April 28, 2016 @02:14PM (#11590832)
Assuming in German C++ is neuter, and referred to with the das article, Modernes Cpp is correct and singular.
Re:Multithreading in modern C++ by cbsmith on Thursday May 05, 2016 @05:06AM (#11634744)
No, I totally get that it is a German variant of the English expression "Modern C++", but you have a fair bit of overlap with a very well established brand in the C++ community...
Re:Multithreading in modern C++ by detaro on Thursday April 28, 2016 @07:26PM (#11592648)
It is.
Re:Multithreading in modern C++ by 77pt77 on Thursday April 28, 2016 @07:23PM (#11592632)
> German C++ is neuter

neuter, was that intentional?

Re:Multithreading in modern C++ by iso-8859-1 on Thursday April 28, 2016 @07:39PM (#11592719)
Re:Multithreading in modern C++ by maxlybbert on Thursday April 28, 2016 @11:25AM (#11589536)
It's been five years (and two standard revisions). Can we stop calling C++11 a new standard?
Re:Multithreading in modern C++ by 2bitencryption on Thursday April 28, 2016 @01:09PM (#11590362)
Standards are not adopted overnight. C++11 is still, effectively, a "new" standard.
Re:Multithreading in modern C++ by maxlybbert on Friday April 29, 2016 @12:16AM (#11593722)
I realize that many projects haven't made the switch, and in some cases they have good reasons to be cautious. And I realize that many programmers aren't familiar with the various changes, even after five (or more) years to catch up.

But that doesn't change the age of the standard, or the fact that C++14 was published, and the Committee is finishing up C++17. At some point it's silly to call C++11 "new." "Unfamiliar," sure, but not "new." It reminds me of Larry Wall's talk ( http://www.wall.org/~larry/pm.html ) "Do you know when New College was founded. Any guesses? New College was new in 1379."

Re:Multithreading in modern C++ by marssaxman on Thursday April 28, 2016 @03:59PM (#11591518)
The industry is still in the process of adopting it. My workplace only switched over six months ago. (That had been annoying, as I picked it up in roughly 2013, and it was hard to unlearn the new habits when I started working here.)

My recollection is that C99 took roughly ten years to go from "the new thing" to "normal".

Re:Multithreading in modern C++ by pjmlp on Thursday April 28, 2016 @05:07PM (#11591886)
Tell that to embedded system guys still having to deal with C++98, not even C++03.
Re:Multithreading in modern C++ by Strangework on Thursday April 28, 2016 @05:59PM (#11592221)
Really depends on where you go. In our office, we use C++11 functionality in our AVR chips.
Re:Multithreading in modern C++ by pjmlp on Friday April 29, 2016 @12:31AM (#11593769)
Sure, but from what I understand by occasionally reading some electronic stuff, many commercial compiler vendors are not even C++03.

For example TI.

Re:Multithreading in modern C++ by aquratic on Thursday April 28, 2016 @08:16PM (#11592895)
Hey, could you elaborate on what C++11 features you use on AVR chips? Thanks in advance :)
Re:Multithreading in modern C++ by ansible on Thursday April 28, 2016 @12:37PM (#11590092)
So I had been looking at threading for an embedded system recently.

I found Intel's Thread Building Blocks [1] which looked exactly like what I wanted.

Unfortunately, there are some long-standing issues with the ARM port, to the point that the included unit tests take a long time and/or crash on ARM (in this case it was on a Nvidia Jetson TK1).

If I had more time and expertise, I'd have tried to debug that further.

So is there anything else in that direction I should be looking at?

[1] https://software.intel.com/en-us/intel-tbb/

Re:Multithreading in modern C++ by iheartmemcache on Thursday April 28, 2016 @02:15PM (#11590839)
1: Which ARM? (Designing for a Cortex M0+ is entirely different from an M3 is from ...)

2: What are your design contraints? (Do you have hard-real time requirements? If so, you're probably going to want to use the primitives that come with the RTOS (QNX/Green Hills Integrity/all-the-major-players have their own method of "IPC/threading/whatever you want to call it" and it's usually an Erlang-esque message passing component.)

3: I'm presuming you're going for automotives, in which case lol, TBB rules but you'll never get ISO 26262 certification using it. If it's for an entertainment thinger just use QNX like everyone else.

4: "Unit tests take a long time and/or crash.." I'm sure the TK1 has ETM (which is better than bondout chips, seriously).

Just look at this[1] (then get your manager to bring me in as a consultant - it pains me to hear you have "long-standing issues with an ARM port" and the way your team-lead thinks he can solve it is with unit tests). "Long time to load which sometimes fails entirely" is a race condition. Insure++ is the "Coverity" for embedded (just as expensive, just as wonderful).

[1] http://i.imgur.com/wcqlon7.png -- how your team lead should be actually debugging embedded components. If you give me more details re: your system/functional/integration requirements, I can likely tell you in which direction to move though.

Re:Multithreading in modern C++ by ansible on Thursday April 28, 2016 @03:52PM (#11591473)
It was a ARM Cortex-A15 SoC. And we're going to have to use regular threads.

Just look at this[1] (then get your manager to bring me in as a consultant - it pains me to hear you have "long-standing issues with an ARM port" and the way your team-lead thinks he can solve it is with unit tests). "Long time to load which sometimes fails entirely" is a race condition. Insure++ is the "Coverity" for embedded (just as expensive, just as wonderful).

I think you misunderstand.

The platform already shipped with TBB. However, when I recompiled TBB from source, the unit tests that came with TBB (which are just peachy on my desktop) took either a long time to run, or crashed. I didn't have to write any unit tests myself.

Before doing any hardcore debugging, I looked around a little and found this:

https://software.intel.com/en-us/forums/intel-threading-buil...

Which still doesn't seem to be fixed correctly in the latest release. That's from 2013, hence the 'long standing issues'. I gave up on TBB before spending much time on it.

Re:Multithreading in modern C++ by iheartmemcache on Thursday April 28, 2016 @06:24PM (#11592331)
Got you - inherited a codebase from someone else - worked fine on your x86(-64/whatever), tried it against your ARM, intermittent failures.

Seems compiling with the -O0 flag fixed some issues for a few chaps, worth a shot I'd imagine, though you've seemed to completed your alternate implementation for the ARM platform.

Alternatively, the TBB errors seem to be when using a gcc deriv that depends on GNU as. Now VS can build ARM binaries (at least, ARM LE bins). It'd be interesting to see if that solves the problem.

What did you end up using instead of TBB? Stock Pthreads/pth? Or did you go with something lighter? Regardless, next time you have to write for embedded stuff hopefully you have a new tool in your belt that'll save you from frustration :)

Re:Multithreading in modern C++ by Matthias247 on Thursday April 28, 2016 @03:43PM (#11591432)
Has nothing to do with the topic, but nevertheless a short comment on (3):

Not really, QNX is quite on the decline here. I know more than 2 major OEMs (and their suppliers) which switched to Linux. I still know some QNX users, but overall Linux looks like the more common thing fur current projects. WinCE was also a major candidate some years ago, but it's now mostly discontinued (no new Windows for Automotive version).

Re:Multithreading in modern C++ by haberman on Thursday April 28, 2016 @10:31AM (#11589104)
Shoot, I have been working on an article describing the C11/C++11 memory model for many months, but it looks like he's going to beat me to it! Oh well, there can be 2 (or 3, or 4... :)
Re:Multithreading in modern C++ by billpg on Thursday April 28, 2016 @08:48AM (#11588378)
Is algorithmen the plural for algorithm?
Re:Multithreading in modern C++ by DrJokepu on Thursday April 28, 2016 @09:02AM (#11588467)
I think this is a translation error. The article is possibly an English translation of an article that was originally written in German. Algorithmen is the plural for algorithm in German.
Re:Multithreading in modern C++ by Certhas on Thursday April 28, 2016 @09:59AM (#11588868)
The entire page is a translation of blog articles that already exist in German.

http://www.grimm-jaud.de/index.php/blog/multithreading-in-mo...

Dozens of follow up articles are on the blog in German.

http://www.grimm-jaud.de/index.php/blog

The Author has published several German books on C++

http://www.grimm-jaud.de/

I have never read any of the books or blog posts, so can't say anything on the quality.

Re:Multithreading in modern C++ by jwilk on Thursday April 28, 2016 @09:39AM (#11588707)
Apparently you can become famous by proof-reading this guy's articles: http://www.modernescpp.com/index.php/for-the-proofreaders-an...

oO

Re:Multithreading in modern C++ by kuschku on Thursday April 28, 2016 @12:51PM (#11590210)
German Humor.
Re:Multithreading in modern C++ by 72deluxe on Thursday April 28, 2016 @05:18PM (#11591965)
Probably more interesting is to read cppreference's examples on std::thread: http://en.cppreference.com/w/cpp/thread/thread

Also, the technical specification for parallel STL algorithms might make interesting reading: https://isocpp.org/files/papers/P0024R2.html

Re:Multithreading in modern C++ by partycoder on Thursday April 28, 2016 @01:21PM (#11590466)
C++ was supposed to be portable. When you add a layer of threading, networking, etc. you are starting to commit to specifics of operating systems.

It's fine to keep this at a library level, and promote that library to be an standard on specific platforms. But C++ should not get tainted with OS specifics.

Re:Multithreading in modern C++ by pjmlp on Thursday April 28, 2016 @05:11PM (#11591911)
On the contrary having a big runtime is what makes a language portable by abstracting it from OS specific APIs.

I only care about OS specific code when using C or C++, not any other language with richer runtimes.

Actually, C's runtime is called UNIX and is packaged as POSIX for non-UNIX OSes.

Any C or C++ developer that wants "portable" code needs to litter their code with #ifdefs, for any dependency not on the standard library.

Re:Multithreading in modern C++ by exacube on Thursday April 28, 2016 @01:57PM (#11590701)
i'm pretty sure they're talking about adding these "layers" at the C++ stdlib level, not at the language level. So it will remain portable.
Re:Multithreading in modern C++ by chris_wot on Thursday April 28, 2016 @08:14AM (#11588199)
The next article should be interesting!
Re:Multithreading in modern C++ by gear54rus on Thursday April 28, 2016 @08:44AM (#11588358)
Is this a joke about unending C++ standards with each one promising more and more cool features people patiently wait for and then when it's finalized it turns out that the coolest/most useful stuff got delayed again?

This is what sprung to mind anyway.

Re:Multithreading in modern C++ by matthewaveryusa on Thursday April 28, 2016 @10:31AM (#11589101)
Herb Sutter addresses this issue in his latest post: https://herbsutter.com/2016/03/11/trip-report-winter-iso-c-s...

I agree, it feels like not a lot, but when you look at the standardization process I think it's safe to say that healthy progress has been made on most if not all the promises made.

Re:Multithreading in modern C++ by chris_wot on Thursday April 28, 2016 @09:20AM (#11588558)
I wish I was that clever.
Re:Multithreading in modern C++ by educar on Thursday April 28, 2016 @07:50PM (#11592766)
Why is this on the front page? Completely void of meaningful content. It just throws around some cpp standards :/
Re:Multithreading in modern C++ by known on Thursday April 28, 2016 @08:57AM (#11588432)
Wow