aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/keyboard.c7
-rw-r--r--src/keyboard.h7
-rw-r--r--src/thread.h9
-rw-r--r--src/w32select.c1
-rw-r--r--test/src/thread-tests.el15
5 files changed, 24 insertions, 15 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 01b9b3c6ba2..cc78548abd0 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -148,9 +148,6 @@ static Lisp_Object regular_top_level_message;
148 148
149static sys_jmp_buf getcjmp; 149static sys_jmp_buf getcjmp;
150 150
151/* True while doing kbd input. */
152bool waiting_for_input;
153
154/* True while displaying for echoing. Delays C-g throwing. */ 151/* True while displaying for echoing. Delays C-g throwing. */
155 152
156static bool echoing; 153static bool echoing;
@@ -322,10 +319,6 @@ static ptrdiff_t echo_length (void);
322/* Incremented whenever a timer is run. */ 319/* Incremented whenever a timer is run. */
323unsigned timers_run; 320unsigned timers_run;
324 321
325/* Address (if not 0) of struct timespec to zero out if a SIGIO interrupt
326 happens. */
327struct timespec *input_available_clear_time;
328
329/* True means use SIGIO interrupts; false means use CBREAK mode. 322/* True means use SIGIO interrupts; false means use CBREAK mode.
330 Default is true if INTERRUPT_INPUT is defined. */ 323 Default is true if INTERRUPT_INPUT is defined. */
331bool interrupt_input; 324bool interrupt_input;
diff --git a/src/keyboard.h b/src/keyboard.h
index a5ed5e10a98..5084c39b7c1 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -415,13 +415,6 @@ extern void unuse_menu_items (void);
415#define EVENT_HEAD_KIND(event_head) \ 415#define EVENT_HEAD_KIND(event_head) \
416 (Fget ((event_head), Qevent_kind)) 416 (Fget ((event_head), Qevent_kind))
417 417
418/* True while doing kbd input. */
419extern bool waiting_for_input;
420
421/* Address (if not 0) of struct timespec to zero out if a SIGIO interrupt
422 happens. */
423extern struct timespec *input_available_clear_time;
424
425extern bool ignore_mouse_drag_p; 418extern bool ignore_mouse_drag_p;
426 419
427extern Lisp_Object parse_modifiers (Lisp_Object); 420extern Lisp_Object parse_modifiers (Lisp_Object);
diff --git a/src/thread.h b/src/thread.h
index 61740321a5c..f10824f1983 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -155,6 +155,15 @@ struct thread_state
155 int m_waiting_for_user_input_p; 155 int m_waiting_for_user_input_p;
156#define waiting_for_user_input_p (current_thread->m_waiting_for_user_input_p) 156#define waiting_for_user_input_p (current_thread->m_waiting_for_user_input_p)
157 157
158 /* True while doing kbd input. */
159 bool m_waiting_for_input;
160#define waiting_for_input (current_thread->m_waiting_for_input)
161
162 /* Address (if not 0) of struct timespec to zero out if a SIGIO interrupt
163 happens. */
164 struct timespec *m_input_available_clear_time;
165#define input_available_clear_time (current_thread->m_input_available_clear_time)
166
158 /* The OS identifier for this thread. */ 167 /* The OS identifier for this thread. */
159 sys_thread_t thread_id; 168 sys_thread_t thread_id;
160 169
diff --git a/src/w32select.c b/src/w32select.c
index 1754534c3d3..36908f96afb 100644
--- a/src/w32select.c
+++ b/src/w32select.c
@@ -77,7 +77,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
77#include "w32common.h" /* os_subtype */ 77#include "w32common.h" /* os_subtype */
78#include "w32term.h" /* for all of the w32 includes */ 78#include "w32term.h" /* for all of the w32 includes */
79#include "w32select.h" 79#include "w32select.h"
80#include "keyboard.h" /* for waiting_for_input */
81#include "blockinput.h" 80#include "blockinput.h"
82#include "coding.h" 81#include "coding.h"
83 82
diff --git a/test/src/thread-tests.el b/test/src/thread-tests.el
index 4631882186c..4e7b052cba0 100644
--- a/test/src/thread-tests.el
+++ b/test/src/thread-tests.el
@@ -209,5 +209,20 @@
209 (string= "hi bob" 209 (string= "hi bob"
210 (condition-name (make-condition-variable (make-mutex) 210 (condition-name (make-condition-variable (make-mutex)
211 "hi bob"))))) 211 "hi bob")))))
212(defun call-error ()
213 "Call `error'."
214 (error "Error is called"))
215
216;; This signals an error internally; the error should be caught.
217(defun thread-custom ()
218 (defcustom thread-custom-face 'highlight
219 "Face used for thread customizations."
220 :type 'face
221 :group 'widget-faces))
222
223(ert-deftest thread-errors ()
224 "Test what happens when a thread signals an error."
225 (should (threadp (make-thread #'call-error "call-error")))
226 (should (threadp (make-thread #'thread-custom "thread-custom"))))
212 227
213;;; threads.el ends here 228;;; threads.el ends here