of Emacs to cope.
if (!initialized)
{
init_alloc_once ();
+ init_threads_once ();
init_obarray ();
init_eval_once ();
init_charset_once ();
PVEC_WINDOW_CONFIGURATION,
PVEC_SUBR,
PVEC_OTHER,
+ PVEC_THREAD,
/* These last 4 are special because we OR them in fns.c:internal_equal,
so they have to use a disjoint bit pattern:
if (!(size & (PVEC_COMPILED | PVEC_CHAR_TABLE
#define XSETCHAR_TABLE(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_CHAR_TABLE))
#define XSETBOOL_VECTOR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BOOL_VECTOR))
#define XSETSUB_CHAR_TABLE(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_SUB_CHAR_TABLE))
+#define XSETTHREAD(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_THREAD))
/* Convenience macros for dealing with Lisp arrays. */
#define SUB_CHAR_TABLE_P(x) PSEUDOVECTORP (x, PVEC_SUB_CHAR_TABLE)
#define BOOL_VECTOR_P(x) PSEUDOVECTORP (x, PVEC_BOOL_VECTOR)
#define FRAMEP(x) PSEUDOVECTORP (x, PVEC_FRAME)
+#define THREADP(x) PSEUDOVECTORP (x, PVEC_THREAD)
/* Test for image (image . spec) */
#define IMAGEP(x) (CONSP (x) && EQ (XCAR (x), Qimage))
}
PRINTCHAR ('>');
}
+ else if (THREADP (obj))
+ {
+ strout ("#<thread ", -1, -1, printcharfun);
+ if (STRINGP (XTHREAD (obj)->name))
+ print_string (XTHREAD (obj)->name, printcharfun);
+ else
+ {
+ int len = sprintf (buf, "%p", XTHREAD (obj));
+ strout (buf, len, len, printcharfun);
+ }
+ PRINTCHAR ('>');
+ }
else
{
ptrdiff_t size = ASIZE (obj);
static void
mark_one_thread (struct thread_state *thread)
{
- register struct specbinding *bind;
+ struct specbinding *bind;
struct handler *handler;
Lisp_Object tem;
mark_stack (thread->m_stack_bottom, thread->stack_top);
#else
{
- register struct gcpro *tail;
+ struct gcpro *tail;
for (tail = thread->m_gcprolist; tail; tail = tail->next)
for (i = 0; i < tail->nvars; i++)
mark_object (tail->var[i]);
struct thread_state *iter;
for (iter = all_threads; iter; iter = iter->next_thread)
- mark_one_thread (iter);
+ {
+ Lisp_Object thread_obj;
+
+ XSETTHREAD (thread_obj, iter);
+ mark_object (thread_obj);
+ mark_one_thread (iter);
+ }
}
void
unmark_byte_stack (iter->m_byte_stack_list);
}
+void
+init_threads_once (void)
+{
+ the_only_thread.header.size
+ = PSEUDOVECSIZE (struct thread_state, m_gcprolist);
+ XSETPVECTYPE (&the_only_thread, PVEC_THREAD);
+ the_only_thread.m_last_thing_searched = Qnil;
+ the_only_thread.m_saved_last_thing_searched = Qnil;
+}
+
void
init_threads (void)
{
struct thread_state
{
+ struct vectorlike_header header;
+
/* The buffer in which the last search was performed, or
Qt if the last search was done in a string;
Qnil if no searching has been done yet. */
extern void unmark_threads (void);
+extern void init_threads_once (void);
extern void init_threads (void);
#endif /* THREAD_H */