Introduce threads.
[emacs.git] / src / thread.h
bloba415727fab21f3adbd10a1b7a1761bce3b2aa2ed
2 struct thread_state
4 /* Recording what needs to be marked for gc. */
5 struct gcpro *m_gcprolist;
6 #define gcprolist (current_thread->m_gcprolist)
8 /* A list of currently active byte-code execution value stacks.
9 Fbyte_code adds an entry to the head of this list before it starts
10 processing byte-code, and it removed the entry again when it is
11 done. Signalling an error truncates the list analoguous to
12 gcprolist. */
13 struct byte_stack *m_byte_stack_list;
14 #define byte_stack_list (current_thread->m_byte_stack_list)
16 /* An address near the bottom of the stack.
17 Tells GC how to save a copy of the stack. */
18 char *stack_bottom;
20 /* An address near the top of the stack. */
21 char *stack_top;
23 struct backtrace *m_backtrace_list;
24 #define backtrace_list (current_thread->m_backtrace_list)
26 struct catchtag *m_catchlist;
27 #define catchlist (current_thread->m_catchlist)
29 /* Chain of condition handlers currently in effect.
30 The elements of this chain are contained in the stack frames
31 of Fcondition_case and internal_condition_case.
32 When an error is signaled (by calling Fsignal, below),
33 this chain is searched for an element that applies. */
34 struct handler *m_handlerlist;
35 #define handlerlist (current_thread->m_handlerlist)
37 /* Count levels of GCPRO to detect failure to UNGCPRO. */
38 int m_gcpro_level;
39 #define gcpro_level (current_thread->m_gcpro_level)
41 /* Current number of specbindings allocated in specpdl. */
42 int m_specpdl_size;
43 #define specpdl_size (current_thread->m_specpdl_size)
45 /* Pointer to beginning of specpdl. */
46 struct specbinding *m_specpdl;
47 #define specpdl (current_thread->m_specpdl)
49 /* Pointer to first unused element in specpdl. */
50 struct specbinding *m_specpdl_ptr;
51 #define specpdl_ptr (current_thread->m_specpdl_ptr)
53 /* Depth in Lisp evaluations and function calls. */
54 int m_lisp_eval_depth;
55 #define lisp_eval_depth (current_thread->m_lisp_eval_depth)
57 /* The function we are evaluating, or 0 in the main thread. */
58 Lisp_Object func;
60 struct thread_state *next;
63 extern __thread struct thread_state *current_thread;
65 extern void init_threads P_ ((void));
67 extern void thread_yield P_ ((void));
69 extern void syms_of_threads P_ ((void));