[gegl] gegl-node: only emit the progress signal from the main thread
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] gegl-node: only emit the progress signal from the main thread
- Date: Fri, 11 Aug 2017 12:58:19 +0000 (UTC)
commit e3787440917255b6936a8d55428aa9402fdfba08
Author: Ell <ell_se yahoo com>
Date: Fri Aug 11 08:44:27 2017 -0400
gegl-node: only emit the progress signal from the main thread
Only emit the progress signal when gegl_node_progress() is called
from the main thread -- don't queue a signal emission from other
threads. Otherwise, the queued signal may be emitted after the
operation is complete, and, in particular, after the node is
destroyed (we could keep a the node alive while the signal is
queued, but that's not really useful.)
Regardless, for auto-threaded ops, each thread would track its
progress independently, so emitting interleaving progress signals
from different threads is not too meaningful anyway, while only
reporting the main thread's progress should give a good-enough
indication of the overall progress.
gegl/graph/gegl-node.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/gegl/graph/gegl-node.c b/gegl/graph/gegl-node.c
index 4f2488a..4d88065 100644
--- a/gegl/graph/gegl-node.c
+++ b/gegl/graph/gegl-node.c
@@ -2198,7 +2198,8 @@ static gboolean delayed_emission (void *data)
/* this causes dispatch of the signal on the main thread - if we
* are in the main thread the callback will be directly executed now
- * instead of queued
+ * instead of queued (XXX: and if we're on a different thread, this function is
+ * a nop -- see comment below.)
*/
void gegl_node_progress (GeglNode *node,
gdouble progress,
@@ -2208,10 +2209,20 @@ void gegl_node_progress (GeglNode *node,
g_signal_emit (node, gegl_node_signals[PROGRESS], 0, progress, message, NULL);
else
{
+ /* XXX: only emit the progress signal from the main thread; otherwise, the
+ * delayed signal may be emitted after the operation is finished, or,
+ * indeed, after the node is destroyed. for auto-threaded operations, each
+ * thread tracks its progress independently, so reporting the progress of
+ * the main thread should be a reasonable estimate of the overall progress.
+ */
+#if 0
Closure *closure = g_new0 (Closure, 1);
closure->node = node;
closure->progress = progress;
g_idle_add (delayed_emission, closure);
+#else
+ (void) delayed_emission;
+#endif
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]