all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Philipp Stephani <p.stephani2@gmail.com>
To: Glenn Morris <rgm@gnu.org>, Eli Zaretskii <eliz@gnu.org>,
	30106@debbugs.gnu.org
Cc: Philipp Stephani <phst@google.com>
Subject: bug#30106: [PATCH 2/2] Fix module support if threads are disabled (Bug#30106)
Date: Wed, 17 Jan 2018 23:28:46 +0100	[thread overview]
Message-ID: <20180117222846.93077-2-phst@google.com> (raw)
In-Reply-To: <20180117222846.93077-1-phst@google.com>

* src/systhread.c (sys_thread_equal): New function.
* src/emacs-module.c (in_current_thread): Use it.
---
 src/emacs-module.c |  7 ++-----
 src/systhread.c    | 18 ++++++++++++++++++
 src/systhread.h    |  1 +
 3 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/src/emacs-module.c b/src/emacs-module.c
index 00f0e86d7d..298080e646 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -31,6 +31,7 @@ along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
 #include "coding.h"
 #include "keyboard.h"
 #include "syssignal.h"
+#include "systhread.h"
 #include "thread.h"
 
 #include <intprops.h>
@@ -805,11 +806,7 @@ in_current_thread (void)
 {
   if (current_thread == NULL)
     return false;
-#ifdef HAVE_PTHREAD
-  return pthread_equal (pthread_self (), current_thread->thread_id);
-#elif defined WINDOWSNT
-  return GetCurrentThreadId () == current_thread->thread_id;
-#endif
+  return sys_thread_equal (sys_thread_self (), current_thread->thread_id);
 }
 
 static void
diff --git a/src/systhread.c b/src/systhread.c
index 4ffb7db143..3f162a2bcb 100644
--- a/src/systhread.c
+++ b/src/systhread.c
@@ -74,6 +74,12 @@ sys_thread_self (void)
   return 0;
 }
 
+bool
+sys_thread_equal (sys_thread_t t, sys_thread_t u)
+{
+  return t == u;
+}
+
 int
 sys_thread_create (sys_thread_t *t, const char *name,
 		   thread_creation_function *func, void *datum)
@@ -155,6 +161,12 @@ sys_thread_self (void)
   return pthread_self ();
 }
 
+bool
+sys_thread_equal (sys_thread_t t, sys_thread_t u)
+{
+  return pthread_equal (t, u);
+}
+
 int
 sys_thread_create (sys_thread_t *thread_ptr, const char *name,
 		   thread_creation_function *func, void *arg)
@@ -323,6 +335,12 @@ sys_thread_self (void)
   return (sys_thread_t) GetCurrentThreadId ();
 }
 
+bool
+sys_thread_equal (sys_thread_t t, sys_thread_t u)
+{
+  return t == u;
+}
+
 static thread_creation_function *thread_start_address;
 
 /* _beginthread wants a void function, while we are passed a function
diff --git a/src/systhread.h b/src/systhread.h
index 4745d22065..5dbb12dffb 100644
--- a/src/systhread.h
+++ b/src/systhread.h
@@ -100,6 +100,7 @@ extern void sys_cond_broadcast (sys_cond_t *);
 extern void sys_cond_destroy (sys_cond_t *);
 
 extern sys_thread_t sys_thread_self (void);
+extern bool sys_thread_equal (sys_thread_t, sys_thread_t);
 
 extern int sys_thread_create (sys_thread_t *, const char *,
 			      thread_creation_function *,
-- 
2.15.1






  reply	other threads:[~2018-01-17 22:28 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-14  6:36 bug#30106: Loading file /sources/emacs/lisp/emacs-lisp/ert.elc failed to provide feature `mod-test' Jean Louis
2018-01-14 16:08 ` Eli Zaretskii
2018-01-14 17:47   ` Jean Louis
2018-01-14 19:44     ` Eli Zaretskii
2018-01-14 22:12       ` Jean Louis
2018-01-15 13:14         ` Eli Zaretskii
2018-01-15 17:56           ` Glenn Morris
2018-01-18 19:35             ` Philipp Stephani
2018-01-18 23:00               ` Glenn Morris
2018-01-15 18:09           ` Jean Louis
2018-01-15 18:55           ` Jean Louis
2018-01-15 20:15             ` Eli Zaretskii
2018-01-16  5:17               ` Jean Louis
2018-01-16 18:06                 ` Glenn Morris
2018-01-16 19:17                   ` Jean Louis
2018-01-16 18:10             ` Eli Zaretskii
2018-01-16 19:18               ` Jean Louis
2018-01-17 15:36                 ` Eli Zaretskii
2018-01-17 17:03                   ` Jean Louis
2018-01-17 18:25                     ` Eli Zaretskii
2018-01-17 18:51                       ` Glenn Morris
2018-01-17 18:58                         ` Glenn Morris
2018-01-17 19:37                           ` Jean Louis
2018-01-18 23:01                             ` Glenn Morris
2018-01-17 20:05                         ` Eli Zaretskii
2018-01-17 20:29                           ` Glenn Morris
2018-01-17 22:16                             ` Philipp Stephani
2018-01-17 22:18                               ` Philipp Stephani
2018-01-17 22:28                                 ` bug#30106: [PATCH 1/2] Use recommended long options syntax in man page Philipp Stephani
2018-01-17 22:28                                   ` Philipp Stephani [this message]
2018-01-18 14:04                                     ` bug#30106: [PATCH 2/2] Fix module support if threads are disabled (Bug#30106) Eli Zaretskii
2018-01-18 14:23                                       ` Philipp Stephani
2018-01-18 15:23                                         ` Eli Zaretskii
2018-01-18 17:41                                           ` Glenn Morris
2018-01-18 18:53                                             ` Eli Zaretskii
2018-01-18 22:55                                               ` Glenn Morris
2018-01-19  7:58                                                 ` Eli Zaretskii
2018-01-20 18:07                                                   ` Glenn Morris
2018-01-20 19:01                                                     ` Eli Zaretskii
2018-01-18 19:25                                           ` Philipp Stephani
2018-01-17 22:35                                   ` bug#30106: [PATCH 1/2] Use recommended long options syntax in man page Philipp Stephani
2018-01-18 13:59                               ` bug#30106: Loading file /sources/emacs/lisp/emacs-lisp/ert.elc failed to provide feature `mod-test' Eli Zaretskii
2018-01-18 17:40                               ` Glenn Morris
2018-01-17 19:20                       ` Jean Louis
2018-01-17 18:32                     ` Andy Moreton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180117222846.93077-2-phst@google.com \
    --to=p.stephani2@gmail.com \
    --cc=30106@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=phst@google.com \
    --cc=rgm@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.