aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.c
diff options
context:
space:
mode:
authorTom Tromey2012-08-15 13:09:32 -0600
committerTom Tromey2012-08-15 13:09:32 -0600
commit1dcacbc64721b1a4de58aa36460b0a39e766be63 (patch)
tree98a07fba97225221d3bcfab970070b5a6a6564d6 /src/data.c
parent60a9d2a7728895c1a5bfbc37c3bfa8fde35abe61 (diff)
downloademacs-1dcacbc64721b1a4de58aa36460b0a39e766be63.tar.gz
emacs-1dcacbc64721b1a4de58aa36460b0a39e766be63.zip
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.c15
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;
94static Lisp_Object Qsubrp, Qmany, Qunevalled; 94static Lisp_Object Qsubrp, Qmany, Qunevalled;
95Lisp_Object Qfont_spec, Qfont_entity, Qfont_object; 95Lisp_Object Qfont_spec, Qfont_entity, Qfont_object;
96static Lisp_Object Qdefun; 96static Lisp_Object Qdefun;
97Lisp_Object Qthread;
97 98
98Lisp_Object Qinteractive_form; 99Lisp_Object Qinteractive_form;
99 100
@@ -211,6 +212,8 @@ for example, (type-of 1) returns `integer'. */)
211 return Qfont_entity; 212 return Qfont_entity;
212 if (FONT_OBJECT_P (object)) 213 if (FONT_OBJECT_P (object))
213 return Qfont_object; 214 return Qfont_object;
215 if (THREADP (object))
216 return Qthread;
214 return Qvector; 217 return Qvector;
215 218
216 case Lisp_Float: 219 case Lisp_Float:
@@ -458,6 +461,16 @@ DEFUN ("floatp", Ffloatp, Sfloatp, 1, 1, 0,
458 return Qnil; 461 return Qnil;
459} 462}
460 463
464DEFUN ("threadp", Fthreadp, Sthreadp, 1, 1, 0,
465 doc: /* Return t if OBJECT is a thread. */)
466 (Lisp_Object object)
467{
468 if (THREADP (object))
469 return Qt;
470 else
471 return Qnil;
472}
473
461 474
462/* Extract and set components of lists */ 475/* Extract and set components of lists */
463 476
@@ -3091,6 +3104,7 @@ syms_of_data (void)
3091 DEFSYM (Qchar_table, "char-table"); 3104 DEFSYM (Qchar_table, "char-table");
3092 DEFSYM (Qbool_vector, "bool-vector"); 3105 DEFSYM (Qbool_vector, "bool-vector");
3093 DEFSYM (Qhash_table, "hash-table"); 3106 DEFSYM (Qhash_table, "hash-table");
3107 DEFSYM (Qthread, "thread");
3094 /* Used by Fgarbage_collect. */ 3108 /* Used by Fgarbage_collect. */
3095 DEFSYM (Qinterval, "interval"); 3109 DEFSYM (Qinterval, "interval");
3096 DEFSYM (Qmisc, "misc"); 3110 DEFSYM (Qmisc, "misc");
@@ -3133,6 +3147,7 @@ syms_of_data (void)
3133 defsubr (&Ssubrp); 3147 defsubr (&Ssubrp);
3134 defsubr (&Sbyte_code_function_p); 3148 defsubr (&Sbyte_code_function_p);
3135 defsubr (&Schar_or_string_p); 3149 defsubr (&Schar_or_string_p);
3150 defsubr (&Sthreadp);
3136 defsubr (&Scar); 3151 defsubr (&Scar);
3137 defsubr (&Scdr); 3152 defsubr (&Scdr);
3138 defsubr (&Scar_safe); 3153 defsubr (&Scar_safe);