On Mon, Oct 30, 2017 at 10:22:03AM -0400, Brian Groose wrote: > Hi Bob, > > Yes, I have -pthread, in fact, it won't even compile (much less try to > link) because the declaration isn't visible without -pthread. > I verified that the linker is looking at the pthread version of libstdc++.a > as well, which shows the type "L" AIX TLS symbols when I run nm on it. > > I've tried compiling gcc without and without --enable-tls, which doesn't > seem to make any difference. Hello Brian I have never used call_once ... so I found a demo program at http://www.cplusplus.com/reference/mutex/call_once/ and compiled it. Results below. bash-4.4$ cat > call_once_2.cpp // call_once example #include <iostream> // std::cout #include <thread> // std::thread, std::this_thread::sleep_for #include <chrono> // std::chrono::milliseconds #include <mutex> // std::call_once, std::once_flag int winner; void set_winner (int x) { winner = x; } std::once_flag winner_flag; void wait_1000ms (int id) { // count to 1000, waiting 1ms between increments: for (int i=0; i<1000; ++i) std::this_thread::sleep_for(std::chrono::milliseconds(1)); // claim to be the winner (only the first such call is executed): std::call_once (winner_flag,set_winner,id); } int main () { std::thread threads[10]; // spawn 10 threads: for (int i=0; i<10; ++i) threads[i] = std::thread(wait_1000ms,i+1); std::cout << "waiting for the first among 10 threads to count 1000 ms...\n"; for (auto& th : threads) th.join(); std::cout << "winner thread: " << winner << '\n'; return 0; } bash-4.4$ g++ -o call_once_2 -pthread call_once_2.cpp -lpthread bash-4.4$ ./call_once_2 waiting for the first among 10 threads to count 1000 ms... winner thread: 2 bash-4.4$ oslevel 6.1.0.0 bash-4.4$ uname -a AIX bobaixgcc62 1 6 00FA21314C00 bash-4.4$ So, that compilation works for me. I am using AIX6.1 as opposed to your AIX 5.3. Please can you try compiling this small program on your system, so that we can establish whether it is an AIX version issue. Or maybe my compilation line will work for you? Bob -- You teach best what you most need to learn.