From 9d2b7928b586d047f0c53ab3b2ecb26a45f36884 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Wed, 4 May 2011 06:16:59 +0000 Subject: [PATCH] * thread.h (pthread::static_cancel_self): Mark as noreturn. (pthread::cancel_self): Ditto. * thread.cc (pthread::cancel_self): Explicitly use pthread::exit to avoid a "function returns" error. --- winsup/cygwin/ChangeLog | 7 +++++++ winsup/cygwin/thread.cc | 4 +++- winsup/cygwin/thread.h | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index da31c6224..04d3bef25 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,10 @@ +2011-05-04 Christopher Faylor + + * thread.h (pthread::static_cancel_self): Mark as noreturn. + (pthread::cancel_self): Ditto. + * thread.cc (pthread::cancel_self): Explicitly use pthread::exit to + avoid a "function returns" error. + 2011-05-04 Christopher Faylor * pinfo.cc (pinfo::pinfo): Set procinfo to NULL to avoid potential diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index a521773d8..60a6d3a77 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -1044,7 +1044,9 @@ pthread::pop_all_cleanup_handlers () void pthread::cancel_self () { - exit (PTHREAD_CANCELED); + /* Can someone explain why the pthread:: is needed here? g++ complains + without it. */ + pthread::exit (PTHREAD_CANCELED); } DWORD diff --git a/winsup/cygwin/thread.h b/winsup/cygwin/thread.h index 37296e5e5..b1969ed81 100644 --- a/winsup/cygwin/thread.h +++ b/winsup/cygwin/thread.h @@ -401,7 +401,7 @@ public: virtual void testcancel (); static HANDLE get_cancel_event (); - static void static_cancel_self (); + static void static_cancel_self () __attribute__ ((noreturn)); virtual int setcancelstate (int state, int *oldstate); virtual int setcanceltype (int type, int *oldtype); @@ -454,7 +454,7 @@ private: void postcreate (); bool create_cancel_event (); static void set_tls_self_pointer (pthread *); - void cancel_self (); + void cancel_self () __attribute__ ((noreturn)); DWORD get_thread_id (); }; -- 2.43.5