1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-09 07:41:40 -07:00

Add a igc--process-messages function

* src/igc.c (Figc__process_messages): New defun.
(process_all_messages): New helper.
(syms_of_igc): Register it.
* test/src/fns-tests.el (ft--gc): Use it.
(ft--test-weak-removal): Pass the weakness argument to ft--gc.
This commit is contained in:
Helmut Eller 2025-10-17 15:45:39 +02:00
parent 78d5793c0b
commit bd0fd46470
2 changed files with 27 additions and 3 deletions

View file

@ -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);

View file

@ -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))