Search code examples
c++multithreadinggccc++11gcc4.9

Is set_value_at_thread_exit() supported on gcc?


This is my first post here so please be lenient :)

I am having a problem with set_value_at_thread_exit() method from promise class (part of c++11). Everything was ok in VS2013 but GCC gives me following error message:

error: ‘class std::promise<int>’ has no member named ‘set_value_at_thread_exit’
    args->result.set_value_at_thread_exit(result);

I've tried GCC 4.8 and 4.9 on Ubuntu 14.04

The code is:

[...]

int result = 0;
Socket socket;
result = CreateUDPSocket(&socket, false, ANY_IP, args->port);
if (result != ERROR_SUCCESS)
{
    args->result.set_value_at_thread_exit(result);
    return;
}
args->result.set_value(ERROR_SUCCESS);

[...]

Solution

  • Unfortunately, it isn't supported yet. If you look at the status page

    30.6.5 | Class template promise | Partial | Missing set_*_at_thread_exit