aboutsummaryrefslogtreecommitdiffstats
path: root/src/sysdep.c
diff options
context:
space:
mode:
authorPaul Eggert2016-12-30 13:01:39 -0800
committerPaul Eggert2016-12-30 13:05:25 -0800
commit966d51592f07ad9de6afebcd828e667cce0f6a27 (patch)
treeae5ee7c99718abec1304682f43b620a1c00ddd06 /src/sysdep.c
parentaef40049e3b81972703d3bde47b0961bcb08d7e1 (diff)
downloademacs-966d51592f07ad9de6afebcd828e667cce0f6a27.tar.gz
emacs-966d51592f07ad9de6afebcd828e667cce0f6a27.zip
Rename main_thread to main_thread_id and simplify
* src/emacs-module.c: Include syssignal.h, for main_thread_id. [HAVE_PTHREAD]: Do not include pthread.h. (main_thread): Remove. All uses replaced by main_thread_id, or by dwMainThreadId on NT. Since the HAVE_PTHREAD code is now using the main_thread_id established by sysdep.c, there is no need for a separate copy of the main thread ID here. (module_init): Remove. All uses removed. * src/sysdep.c (main_thread_id) [HAVE_PTHREAD]: Rename from main_thread. All uses changed. Now extern.
Diffstat (limited to 'src/sysdep.c')
-rw-r--r--src/sysdep.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/sysdep.c b/src/sysdep.c
index 1ba336e387a..1227afc8db7 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -1612,7 +1612,7 @@ emacs_sigaction_init (struct sigaction *action, signal_handler_t handler)
1612} 1612}
1613 1613
1614#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD 1614#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD
1615static pthread_t main_thread; 1615pthread_t main_thread_id;
1616#endif 1616#endif
1617 1617
1618/* SIG has arrived at the current process. Deliver it to the main 1618/* SIG has arrived at the current process. Deliver it to the main
@@ -1636,13 +1636,13 @@ deliver_process_signal (int sig, signal_handler_t handler)
1636 1636
1637 bool on_main_thread = true; 1637 bool on_main_thread = true;
1638#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD 1638#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD
1639 if (! pthread_equal (pthread_self (), main_thread)) 1639 if (! pthread_equal (pthread_self (), main_thread_id))
1640 { 1640 {
1641 sigset_t blocked; 1641 sigset_t blocked;
1642 sigemptyset (&blocked); 1642 sigemptyset (&blocked);
1643 sigaddset (&blocked, sig); 1643 sigaddset (&blocked, sig);
1644 pthread_sigmask (SIG_BLOCK, &blocked, 0); 1644 pthread_sigmask (SIG_BLOCK, &blocked, 0);
1645 pthread_kill (main_thread, sig); 1645 pthread_kill (main_thread_id, sig);
1646 on_main_thread = false; 1646 on_main_thread = false;
1647 } 1647 }
1648#endif 1648#endif
@@ -1668,12 +1668,12 @@ deliver_thread_signal (int sig, signal_handler_t handler)
1668 int old_errno = errno; 1668 int old_errno = errno;
1669 1669
1670#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD 1670#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD
1671 if (! pthread_equal (pthread_self (), main_thread)) 1671 if (! pthread_equal (pthread_self (), main_thread_id))
1672 { 1672 {
1673 thread_backtrace_npointers 1673 thread_backtrace_npointers
1674 = backtrace (thread_backtrace_buffer, BACKTRACE_LIMIT_MAX); 1674 = backtrace (thread_backtrace_buffer, BACKTRACE_LIMIT_MAX);
1675 sigaction (sig, &process_fatal_action, 0); 1675 sigaction (sig, &process_fatal_action, 0);
1676 pthread_kill (main_thread, sig); 1676 pthread_kill (main_thread_id, sig);
1677 1677
1678 /* Avoid further damage while the main thread is exiting. */ 1678 /* Avoid further damage while the main thread is exiting. */
1679 while (1) 1679 while (1)
@@ -1796,7 +1796,7 @@ handle_sigsegv (int sig, siginfo_t *siginfo, void *arg)
1796 bool fatal = gc_in_progress; 1796 bool fatal = gc_in_progress;
1797 1797
1798#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD 1798#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD
1799 if (!fatal && !pthread_equal (pthread_self (), main_thread)) 1799 if (!fatal && !pthread_equal (pthread_self (), main_thread_id))
1800 fatal = true; 1800 fatal = true;
1801#endif 1801#endif
1802 1802
@@ -1888,7 +1888,7 @@ init_signals (bool dumping)
1888 sigemptyset (&empty_mask); 1888 sigemptyset (&empty_mask);
1889 1889
1890#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD 1890#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD
1891 main_thread = pthread_self (); 1891 main_thread_id = pthread_self ();
1892#endif 1892#endif
1893 1893
1894#if !HAVE_DECL_SYS_SIGLIST && !defined _sys_siglist 1894#if !HAVE_DECL_SYS_SIGLIST && !defined _sys_siglist