• Eli Zaretskii's avatar
    Simplify recording of main thread's ID on MS-Windows · d696d62f
    Eli Zaretskii authored
    * src/w32term.c (w32_initialize):
    * src/w32console.c (initialize_w32_display):
    * src/w32fns.c (globals_of_w32fns): Don't record the main thread
    ID independently for each type of session (GUI, TTY, batch).
    * src/w32term.c (w32_init_main_thread): New function, records the
    main thread's thread ID.
    * src/w32term.h: Add prototype for w32_init_main_thread.
    * src/emacs.c (main) [WINDOWSNT]: Call w32_init_main_thread.
    
    * src/emacs-module.c [WINDOWSNT]: Rename main_thread_id to
    main_thread, for consistency with other threading libraries.  All
    users changed.  Include w32term.h.
    (check_main_thread) [WINDOWSNT]: Simplify the test: no need to
    make sure the main thread is alive, as we hold a handle on it
    opened by w32_init_main_thread.
    (module_init) [WINDOWSNT]: Reuse the thread ID recorded by
    w32_init_main_thread, instead of calling the requisite APIs once
    more.
    d696d62f
w32fns.c 315 KB