<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<title></title>
<style type="text/css">code{white-space: pre;}</style>
</head>
<body>
<p>Hi again,</p>
<p>On 2017-03-24 03:28, Filip Roséen wrote:</p>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code> This added utility will make it easier to handle a queue of tasks that
is to be finished in the order received. It allows for users of the
utility to focus on the end-goal instead of having to deal with
synchronization issues in terms of task-queue handling.</code></pre>
</blockquote>
<p>I just noticed that I did not apply the appropriate <em>fixup</em>, before doing <code>git format-patch</code> + <code>git send-email</code>, to fix a slight unit issue in terms of the background-worker timeout, as well as allowing backwards compatibility where a negative timeout is also accepted as a value indicating that no timeout is set.</p>
<p>The attached patch is a revised implementation of the patch in which this email is a reply to, but for easier reviewing the difference between the two is that of the below:</p>
<pre><code>diff --git a/src/misc/background_worker.c b/src/misc/background_worker.c
index 527509fb98..8009a601b1 100644
--- a/src/misc/background_worker.c
+++ b/src/misc/background_worker.c
@@ -78,7 +78,7 @@ static void* Thread( void* data )
worker->head.id = item ? item->id : NULL;
if( item && item->timeout > 0 )
- worker->head.deadline = mdate() + item->timeout;
+ worker->head.deadline = mdate() + item->timeout * 1000;
}
vlc_cond_broadcast( &worker->head.wait );
vlc_mutex_unlock( &worker->head.lock );
@@ -191,7 +191,7 @@ int background_worker_Push( struct background_worker* worker, void* entity,
item->id = id;
item->entity = entity;
- item->timeout = timeout ? timeout*1000 : worker->conf.default_timeout;
+ item->timeout = timeout > 0 ? timeout : worker->conf.default_timeout;
vlc_mutex_lock( &worker->tail.lock );
vlc_array_append( &worker->tail.data, item );
diff --git a/src/misc/background_worker.h b/src/misc/background_worker.h
index 8232c1d80a..1382781540 100644
--- a/src/misc/background_worker.h
+++ b/src/misc/background_worker.h
@@ -23,9 +23,9 @@ struct background_worker_config {
/**
* Default timeout for completing a task
*
- * If `0` a task can run indefinitely without being killed, whereas a value
- * other than `0` denotes the maximum number of milliseconds a task can run
- * before \ref pf_stop is called to kill it.
+ * If less-than 0 a task can run indefinitely without being killed, whereas
+ * a positive value denotes the maximum number of milliseconds a task can
+ * run before \ref pf_stop is called to kill it.
**/
mtime_t default_timeout;</code></pre>
<p>I apologize for the inconvenience.</p>
<p>Best Regards,<br />
Filip “in need of a smoke” Roséen</p>
</body>
</html>