diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2016-12-30 13:01:39 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2016-12-30 13:05:25 -0800 |
commit | 966d51592f07ad9de6afebcd828e667cce0f6a27 (patch) | |
tree | ae5ee7c99718abec1304682f43b620a1c00ddd06 /src/emacs-module.c | |
parent | aef40049e3b81972703d3bde47b0961bcb08d7e1 (diff) | |
download | emacs-966d51592f07ad9de6afebcd828e667cce0f6a27.tar.gz emacs-966d51592f07ad9de6afebcd828e667cce0f6a27.tar.bz2 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/emacs-module.c')
-rw-r--r-- | src/emacs-module.c | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/src/emacs-module.c b/src/emacs-module.c index 68aeb0ce704..280c0550c9b 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c @@ -28,6 +28,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "lisp.h" #include "dynlib.h" #include "coding.h" +#include "syssignal.h" #include <intprops.h> #include <verify.h> @@ -41,15 +42,9 @@ enum { module_has_cleanup = true }; enum { module_has_cleanup = false }; #endif -/* Handle to the main thread. Used to verify that modules call us in - the right thread. */ -#ifdef HAVE_PTHREAD -# include <pthread.h> -static pthread_t main_thread; -#elif defined WINDOWSNT +#ifdef WINDOWSNT #include <windows.h> #include "w32term.h" -static DWORD main_thread; #endif /* True if Lisp_Object and emacs_value have the same representation. @@ -751,9 +746,9 @@ static void check_main_thread (void) { #ifdef HAVE_PTHREAD - eassert (pthread_equal (pthread_self (), main_thread)); + eassert (pthread_equal (pthread_self (), main_thread_id)); #elif defined WINDOWSNT - eassert (GetCurrentThreadId () == main_thread); + eassert (GetCurrentThreadId () == dwMainThreadId); #endif } @@ -1062,20 +1057,3 @@ syms_of_module (void) DEFSYM (Qinternal__module_call, "internal--module-call"); defsubr (&Sinternal_module_call); } - -/* Unlike syms_of_module, this initializer is called even from an - initialized (dumped) Emacs. */ - -void -module_init (void) -{ - /* It is not guaranteed that dynamic initializers run in the main thread, - therefore detect the main thread here. */ -#ifdef HAVE_PTHREAD - main_thread = pthread_self (); -#elif defined WINDOWSNT - /* The 'main' function already recorded the main thread's thread ID, - so we need just to use it . */ - main_thread = dwMainThreadId; -#endif -} |