diff --git a/src/igc.c b/src/igc.c index 3d1c2e5f80b..c7afa84b8c9 100644 --- a/src/igc.c +++ b/src/igc.c @@ -4084,6 +4084,13 @@ igc_process_messages (void) } } +static void +process_all_messages (void) +{ + while (process_one_message (global_igc)) + ; +} + /* Discard entries for killed buffers from LIST and return the resulting list. Used in window-{next,prev}-buffers. */ @@ -4305,6 +4312,17 @@ DEFUN ("igc--collect", Figc__collect, Sigc__collect, 0, 0, 0, return Qnil; } +DEFUN ("igc--process-messages", Figc__process_messages, + Sigc__process_messages, 0, 0, 0, + doc: /* Process all queued MPS messages. + +For internal use only. */) +(void) +{ + process_all_messages (); + return Qnil; +} + size_t igc_hash (Lisp_Object key) { @@ -5705,6 +5723,7 @@ syms_of_igc (void) defsubr (&Sigc_info); defsubr (&Sigc__roots); defsubr (&Sigc__collect); + defsubr (&Sigc__process_messages); defsubr (&Sigc__set_commit_limit); defsubr (&Sigc__set_pause_time); defsubr (&Sigc__add_extra_dependency); diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index 32ea8de8a90..af2b1544d3c 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el @@ -1310,9 +1310,14 @@ do (ft--check-entry w k1 v1 k2 v2)) (should (= (length expected) (length actual))))) -(defun ft--gc () +(defun ft--gc (weakness) (cond ((fboundp 'igc--collect) - (igc--collect)) + (igc--collect) + (cl-ecase weakness + (key-or-value + (igc--process-messages) + (igc--collect)) + ((key value key-and-value)))) (t (garbage-collect)))) @@ -1326,7 +1331,7 @@ (table (make-hash-table :weakness weakness)) (f (lambda () (ft--populate-hashtable table (ft--nentries)))) (pairs (thread-join (make-thread f)))) - (ft--gc) + (ft--gc weakness) (ft--check-entries table pairs))) (ert-deftest ft-weak-key-removal () (ft--test-weak-removal 'key))