diff options
author | Tom Tromey <tromey@redhat.com> | 2012-08-15 13:09:32 -0600 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2012-08-15 13:09:32 -0600 |
commit | 1dcacbc64721b1a4de58aa36460b0a39e766be63 (patch) | |
tree | 98a07fba97225221d3bcfab970070b5a6a6564d6 /src/data.c | |
parent | 60a9d2a7728895c1a5bfbc37c3bfa8fde35abe61 (diff) | |
download | emacs-1dcacbc64721b1a4de58aa36460b0a39e766be63.tar.gz |
This adds most of the thread features visible to emacs lisp.
I roughly followed the Bordeaux threads API:
http://trac.common-lisp.net/bordeaux-threads/wiki/ApiDocumentation
... but not identically. In particular I chose not to implement
interrupt-thread or destroy-thread, but instead a thread-signalling
approach.
I'm still undecided about *default-special-bindings* (which I did not
implement). I think it would be more emacs-like to capture the let
bindings at make-thread time, but IIRC Stefan didn't like this idea
the first time around.
There are one or two semantics issues pointed out in the patch where I
could use some advice.
Diffstat (limited to 'src/data.c')
-rw-r--r-- | src/data.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/data.c b/src/data.c index d0ef5734abc..fd2194fe1ae 100644 --- a/src/data.c +++ b/src/data.c @@ -94,6 +94,7 @@ static Lisp_Object Qchar_table, Qbool_vector, Qhash_table; static Lisp_Object Qsubrp, Qmany, Qunevalled; Lisp_Object Qfont_spec, Qfont_entity, Qfont_object; static Lisp_Object Qdefun; +Lisp_Object Qthread; Lisp_Object Qinteractive_form; @@ -211,6 +212,8 @@ for example, (type-of 1) returns `integer'. */) return Qfont_entity; if (FONT_OBJECT_P (object)) return Qfont_object; + if (THREADP (object)) + return Qthread; return Qvector; case Lisp_Float: @@ -458,6 +461,16 @@ DEFUN ("floatp", Ffloatp, Sfloatp, 1, 1, 0, return Qnil; } +DEFUN ("threadp", Fthreadp, Sthreadp, 1, 1, 0, + doc: /* Return t if OBJECT is a thread. */) + (Lisp_Object object) +{ + if (THREADP (object)) + return Qt; + else + return Qnil; +} + /* Extract and set components of lists */ @@ -3091,6 +3104,7 @@ syms_of_data (void) DEFSYM (Qchar_table, "char-table"); DEFSYM (Qbool_vector, "bool-vector"); DEFSYM (Qhash_table, "hash-table"); + DEFSYM (Qthread, "thread"); /* Used by Fgarbage_collect. */ DEFSYM (Qinterval, "interval"); DEFSYM (Qmisc, "misc"); @@ -3133,6 +3147,7 @@ syms_of_data (void) defsubr (&Ssubrp); defsubr (&Sbyte_code_function_p); defsubr (&Schar_or_string_p); + defsubr (&Sthreadp); defsubr (&Scar); defsubr (&Scdr); defsubr (&Scar_safe); |