LWN.net Logo

A look at C++14, part 1

A look at C++14, part 1

Posted Mar 31, 2013 18:46 UTC (Sun) by jwakely (subscriber, #60262)
In reply to: A look at C++14, part 1 by nix
Parent article: A look at C++14, part 1

> An awful lot of libraries pull in libpthread just in case they are used with threaded programs.

This is not the C++ runtime's fault though, libstdc++ goes to a lot of effort to avoid locking in non-threaded programs, but sufficiently motivated fools^Wprogrammers can defeat that effort.

If you really need to skin that cat you can build GCC with --disable-threads and use that libstdc++.so


(Log in to post comments)

A look at C++14, part 1

Posted Apr 1, 2013 23:03 UTC (Mon) by nix (subscriber, #2304) [Link]

Indeed. Unfortunately, a lot of programmers don't realize they can use pthread locking functions even without linking to libpthread, getting stubs unless something else has loaded libpthread. The total lack of glibc libpthread documentation might explain this :)

(actually, I can't remember if they're stubs or weak symbols. Stubs, I think, so you don't even need to wrap their uses in null checks.)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds