return scm_is_true(rc) ? EXIT_SUCCESS : EXIT_FAILURE;
}
-static void ls3_scm_init(void *unused)
+static void ls3_module_init(void *unused)
{
- /* Need scm_c_eval_string("#t") here to prevent.
+ /* Install some hacks and create the "lipe" (LS3_MODULE_NAME)
+ * module. This is called before any options are handled.
+ *
+ * We needed scm_c_eval_string("#t") early to prevent the
+ * following with multiple threads. Probably not needed
+ * anymore.
+ *
* Backtrace:
* In ice-9/boot-9.scm:
* 157: 3 [catch #t #<catch-closure 2774e80> ...]
*/
scm_c_eval_string("#t");
+ /* In guile-2.0.9 (catch ...) has pretty high overhead when
+ * multi-threaded since it uses (make-prompt-tag "prompt")
+ * which returns (gensym "prompt) and (gensym ...) takes two
+ * global mutexes. In guile 283ab48d3f make-prompt-tag was
+ * changed to return (list "prompt") instead of calling
+ * gensym. We override make-prompt-tag to do the same. */
+ scm_c_eval_string("(set! make-prompt-tag (lambda* (#:optional (stem \"prompt\")) (list stem)))");
+
ls3_scm_fid_vtable = scm_make_vtable(
scm_from_utf8_string("uwuw"),
scm_c_define_gsubr("%fid-printer", 2, 0, 0, &ls3_scm_fid_printer));
# include "ls3_main.x"
#endif
+ /* Every symbol exported by the lipe module needs to be listed
+ * here. Unfortunately? */
scm_c_export(
"FNM_CASEFOLD",
"fnmatch?",
ls3_tid = syscall(SYS_gettid);
/* Define our primitives before loading any files. */
- scm_c_define_module(LS3_MODULE_NAME, &ls3_scm_init, NULL);
+ scm_c_define_module(LS3_MODULE_NAME, &ls3_module_init, NULL);
while ((c = getopt_long(argc, argv, "hil:s:v", options, NULL)) != EOF) {
switch (c) {