]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow access to the minibuffer only to a thread at time.
authorGiuseppe Scrivano <gscrivano@gnu.org>
Thu, 17 Sep 2009 21:48:34 +0000 (23:48 +0200)
committerGiuseppe Scrivano <gscrivano@gnu.org>
Thu, 17 Sep 2009 21:48:34 +0000 (23:48 +0200)
src/fns.c
src/minibuf.c
src/thread.h

index 7b4f3e7a549be7280204ee45d9b2a53dcde7b434..4282ce34468cb74860602d1a243da9c4b04e9efb 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -78,6 +78,8 @@ static int internal_equal P_ ((Lisp_Object , Lisp_Object, int, int));
 extern long get_random ();
 extern void seed_random P_ ((long));
 
+static Lisp_Object Fyes_or_no1 (Lisp_Object prompt);
+
 #ifndef HAVE_UNISTD_H
 extern long time ();
 #endif
@@ -2732,6 +2734,20 @@ Under a windowing system a dialog box will be used if `last-nonmenu-event'
 is nil, and `use-dialog-box' is non-nil.  */)
      (prompt)
      Lisp_Object prompt;
+{
+  Lisp_Object ret;
+  int count = SPECPDL_INDEX ();
+
+  Finhibit_yield (Qt);
+  record_unwind_protect (Finhibit_yield, Qnil);
+  ret = Fyes_or_no1 (prompt);
+
+  unbind_to (count, Qnil);
+  return ret;
+}
+
+Lisp_Object
+Fyes_or_no1 (Lisp_Object prompt)
 {
   register Lisp_Object ans;
   Lisp_Object args[2];
index 1b93228feef33be09c4a5aac34219c7574b4154b..42920eabb784d4620ed9fd66d45ea0128319e282 100644 (file)
@@ -584,8 +584,12 @@ read_minibuf (map, initial, prompt, backup_n, expflag,
                                         Fcons (Vminibuffer_history_variable,
                                                minibuf_save_list))))));
 
+
+  Finhibit_yield (Qt);
+  record_unwind_protect (Finhibit_yield, Qnil);
   record_unwind_protect (read_minibuf_unwind, Qnil);
   minibuf_level++;
+
   /* We are exiting the minibuffer one way or the other, so run the hook.
      It should be run before unwinding the minibuf settings.  Do it
      separately from read_minibuf_unwind because we need to make sure that
index 69e801f9a3f2e5b0a0ef1d93ea13ec3b5c7e667e..21f04b3f210ec951b93b6acb73cc8a74c638795d 100644 (file)
@@ -90,3 +90,5 @@ extern pthread_mutex_t global_lock;
 extern int other_threads_p P_ ((void));
 
 extern int user_thread_p P_ ((void));
+
+EXFUN (Finhibit_yield, 1);