Results 1 to 3 of 3

Thread: C++11 threading.

  1. #1
    Join Date
    Aug 2013
    Beans
    9

    C++11 threading.

    Yep. Moving 'Buntu 13.10 has been nothing short of disastrous. Another thing I've found to be working improperly is threading.
    Consider this simple piece of code:
    Code:
    #include <iostream>
    #include <thread>
    int main()
    {
        std::thread t ([]()
        {
            std::cout << "Hello, World!";
        });
        t.join();
        return 0;
    }
    Compiled with:
    Code:
    g++  main.cpp -o main -pthread -std=c++11
    That, on 13.10, throws an exception:
    Code:
    terminate called after throwing an instance of 'std::system_error'  what():  Enable multithreading to use std::thread: Operation not permitted
    Aborted (core dumped)
    ... and executes just fine on 13.04. The compiler used in both cases is GCC 4.8.1.
    Compiled, and linked against pthread, the same way in both cases.

    What's the matter with you, 13.10? What am I doing wrong?

  2. #2
    Join Date
    Jul 2007
    Location
    Poland
    Beans
    4,499
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: C++11 threading.

    apparently bugzored g++
    if you check the result with ldd there is no pthread to be seen

    workaround: slap -Wl,--no-as-needed at the end
    https://bugs.launchpad.net/ubuntu/+s...s/+bug/1228201
    if your question is answered, mark the thread as [SOLVED]. Thx.
    To post code or command output, use [code] tags.
    Check your bash script here // BashFAQ // BashPitfalls

  3. #3
    Join Date
    Aug 2013
    Beans
    9

    Re: C++11 threading.

    Quote Originally Posted by Vaphell View Post
    apparently bugzored g++
    if you check the result with ldd there is no pthread to be seen

    workaround: slap -Wl,--no-as-needed at the end
    https://bugs.launchpad.net/ubuntu/+s...s/+bug/1228201
    Bah. Thank you. I should seriously improve my search-fu.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •