summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/guile-fibers-libevent-timeout.patch
diff options
context:
space:
mode:
authorJohn Kehayias <john.kehayias@protonmail.com>2024-03-31 20:46:45 -0400
committerJohn Kehayias <john.kehayias@protonmail.com>2024-03-31 20:46:45 -0400
commit155f23a52e626e8ac60f818937d5bb1a3ebe3184 (patch)
treea19317812471db31ae2a97844d6cf74e45057466 /gnu/packages/patches/guile-fibers-libevent-timeout.patch
parentd9dee5ea2f564fa6979ae552fd9bd5ac22f86ecc (diff)
parent1cba1f8ce6f84c4737650401c0eb0473a45f9ff7 (diff)
Merge branch 'master' into mesa-updates
Change-Id: I4cd94a58b62d8c3987e4a60c76b37894ad851e35
Diffstat (limited to 'gnu/packages/patches/guile-fibers-libevent-timeout.patch')
-rw-r--r--gnu/packages/patches/guile-fibers-libevent-timeout.patch61
1 files changed, 61 insertions, 0 deletions
diff --git a/gnu/packages/patches/guile-fibers-libevent-timeout.patch b/gnu/packages/patches/guile-fibers-libevent-timeout.patch
new file mode 100644
index 0000000000..c33678eea3
--- /dev/null
+++ b/gnu/packages/patches/guile-fibers-libevent-timeout.patch
@@ -0,0 +1,61 @@
+commit 2ca397bfcca94c106380368b5b0ce920b0a62a95
+Author: Ludovic Courtès <ludo@gnu.org>
+Date: Sat Jan 6 16:22:45 2024 +0100
+
+ libevent: Fix computation of the timeout value.
+
+diff --git a/extensions/libevent.c b/extensions/libevent.c
+index 134460a..62e50a3 100644
+--- a/extensions/libevent.c
++++ b/extensions/libevent.c
+@@ -192,30 +192,27 @@ scm_primitive_resize (SCM lst, SCM eventsv)
+ }
+ #undef FUNC_NAME
+
+-static uint64_t time_units_per_microsec;
++static uint64_t time_units_per_microsec, microsec_per_time_units;
+
+ static void*
+ run_event_loop (void *p)
+ #define FUNC_NAME "primitive-event-loop"
+ {
+- int ret = 0;
+- int microsec = 0;
+- struct timeval tv;
+-
++ int ret;
+ struct loop_data *data = p;
+
+- if (data->timeout < 0)
+- microsec = -1;
+- else if (data->timeout >= 0)
++ if (data->timeout >= 0)
+ {
+- microsec = (time_units_per_microsec == 0)
+- ? 0 : data->timeout / time_units_per_microsec;
+- tv.tv_sec = 0;
+- tv.tv_usec = microsec;
+- }
++ struct timeval tv;
++
++ tv.tv_sec = data->timeout / scm_c_time_units_per_second;
++ tv.tv_usec =
++ time_units_per_microsec > 0
++ ? ((data->timeout % scm_c_time_units_per_second)
++ / time_units_per_microsec)
++ : ((data->timeout % scm_c_time_units_per_second)
++ * microsec_per_time_units);
+
+- if (microsec >= 0)
+- {
+ ret = event_base_loopexit (data->base, &tv);
+ if (ret == -1)
+ SCM_MISC_ERROR ("event loop exit failed", SCM_EOL);
+@@ -307,6 +304,7 @@ void
+ init_fibers_libevt (void)
+ {
+ time_units_per_microsec = scm_c_time_units_per_second / 1000000;
++ microsec_per_time_units = 1000000 / scm_c_time_units_per_second;
+
+ scm_c_define_gsubr ("primitive-event-wake", 1, 0, 0,
+ scm_primitive_event_wake);