Move all locking logic into thread.c.
[emacs.git] / src / thread.h
blobac5cb010c5762d582d834101ff5f65920e7251eb
2 struct thread_state
4 EMACS_UINT size;
5 struct Lisp_Vector *next;
7 /* The function we are evaluating, or 0 in the main thread. */
8 Lisp_Object func;
10 /* An alias of symbols and values that we use to populate the
11 initial specpdl. */
12 Lisp_Object initial_specpdl;
14 /* Recording what needs to be marked for gc. */
15 struct gcpro *m_gcprolist;
16 #define gcprolist (current_thread->m_gcprolist)
18 /* A list of currently active byte-code execution value stacks.
19 Fbyte_code adds an entry to the head of this list before it starts
20 processing byte-code, and it removed the entry again when it is
21 done. Signalling an error truncates the list analoguous to
22 gcprolist. */
23 struct byte_stack *m_byte_stack_list;
24 #define byte_stack_list (current_thread->m_byte_stack_list)
26 /* An address near the bottom of the stack.
27 Tells GC how to save a copy of the stack. */
28 char *stack_bottom;
30 /* An address near the top of the stack. */
31 char *stack_top;
33 struct backtrace *m_backtrace_list;
34 #define backtrace_list (current_thread->m_backtrace_list)
36 struct catchtag *m_catchlist;
37 #define catchlist (current_thread->m_catchlist)
39 /* Chain of condition handlers currently in effect.
40 The elements of this chain are contained in the stack frames
41 of Fcondition_case and internal_condition_case.
42 When an error is signaled (by calling Fsignal, below),
43 this chain is searched for an element that applies. */
44 struct handler *m_handlerlist;
45 #define handlerlist (current_thread->m_handlerlist)
47 /* Count levels of GCPRO to detect failure to UNGCPRO. */
48 int m_gcpro_level;
49 #define gcpro_level (current_thread->m_gcpro_level)
51 /* Current number of specbindings allocated in specpdl. */
52 int m_specpdl_size;
53 #define specpdl_size (current_thread->m_specpdl_size)
55 /* Pointer to beginning of specpdl. */
56 struct specbinding *m_specpdl;
57 #define specpdl (current_thread->m_specpdl)
59 /* Pointer to first unused element in specpdl. */
60 struct specbinding *m_specpdl_ptr;
61 #define specpdl_ptr (current_thread->m_specpdl_ptr)
63 /* Depth in Lisp evaluations and function calls. */
64 int m_lisp_eval_depth;
65 #define lisp_eval_depth (current_thread->m_lisp_eval_depth)
67 /* This points to the current buffer. */
68 struct buffer *m_current_buffer;
69 #define current_buffer (current_thread->m_current_buffer)
71 struct thread_state *next_thread;
73 pthread_t pthread_id;
75 /* If nonzero the thread access a buffer without lock it. */
76 int nolock;
79 extern __thread struct thread_state *current_thread;
81 extern void init_threads P_ ((void));
83 extern void thread_yield P_ ((void));
85 extern void syms_of_threads P_ ((void));
87 extern Lisp_Object get_current_thread P_ ((void));
89 extern Lisp_Object get_main_thread P_ ((void));
91 extern pthread_mutex_t global_lock;
93 extern int other_threads_p P_ ((void));
95 extern int user_thread_p P_ ((void));
97 EXFUN (Finhibit_yield, 1);
99 extern int thread_inhibit_yield_p P_ ((void));
101 extern void thread_acquire_buffer (char *, void *);