summaryrefslogtreecommitdiff
path: root/src/emacs-module.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emacs-module.c')
-rw-r--r--src/emacs-module.c30
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
-}