mirror of git://gcc.gnu.org/git/gcc.git
PR libstdc++/84442 if _Exit isn't declared then use _exit instead
PR libstdc++/84442 * testsuite/30_threads/thread/cons/terminate.cc [!_GLIBCXX_USE_C99_STDLIB] : Use _exit or std::exit instead of _Exit. From-SVN: r259463
This commit is contained in:
parent
001ddaa852
commit
8cc8789fb4
|
|
@ -1,3 +1,9 @@
|
||||||
|
2018-04-18 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
|
PR libstdc++/84442
|
||||||
|
* testsuite/30_threads/thread/cons/terminate.cc
|
||||||
|
[!_GLIBCXX_USE_C99_STDLIB] : Use _exit or std::exit instead of _Exit.
|
||||||
|
|
||||||
2018-04-18 David Malcolm <dmalcolm@redhat.com>
|
2018-04-18 David Malcolm <dmalcolm@redhat.com>
|
||||||
|
|
||||||
PR jit/85384
|
PR jit/85384
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,19 @@
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#if !_GLIBCXX_USE_C99_STDLIB && defined _GLIBCXX_HAVE_UNISTD_H
|
||||||
|
# include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
void handle_terminate()
|
void handle_terminate()
|
||||||
{
|
{
|
||||||
|
#if _GLIBCXX_USE_C99_STDLIB
|
||||||
std::_Exit(0);
|
std::_Exit(0);
|
||||||
|
#elif defined _GLIBCXX_HAVE_UNISTD_H
|
||||||
|
_exit(0);
|
||||||
|
#else
|
||||||
|
std::exit(0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void f() { throw 1; }
|
void f() { throw 1; }
|
||||||
|
|
@ -38,7 +47,9 @@ test01()
|
||||||
{
|
{
|
||||||
std::set_terminate(handle_terminate);
|
std::set_terminate(handle_terminate);
|
||||||
std::thread t(f);
|
std::thread t(f);
|
||||||
|
// This should call the terminate handler and exit with zero status:
|
||||||
t.join();
|
t.join();
|
||||||
|
// Should not reach here:
|
||||||
std::abort();
|
std::abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue