[vlc-commits] misc/background_worker: allow for indefinite wait (no timeout)

Filip Roséen git at videolan.org
Wed Apr 5 14:12:13 CEST 2017


vlc | branch: master | Filip Roséen <filip at atch.se> | Tue Apr  4 22:50:08 2017 +0200| [6655aedbaf12e0c8c29a0ef3f596015bd7d347da] | committer: Thomas Guillem

misc/background_worker: allow for indefinite wait (no timeout)

A negative value now denotes that the default timeout associated with
the background worker shall be used, 0 means that there shall be no
timeout.

This fixes a regression where the documented behavior of
playlist_preparser_Push differed from the underlying implementation.

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6655aedbaf12e0c8c29a0ef3f596015bd7d347da
---

 src/misc/background_worker.c | 2 +-
 src/misc/background_worker.h | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/misc/background_worker.c b/src/misc/background_worker.c
index 8009a60..be4e768 100644
--- a/src/misc/background_worker.c
+++ b/src/misc/background_worker.c
@@ -191,7 +191,7 @@ int background_worker_Push( struct background_worker* worker, void* entity,
 
     item->id = id;
     item->entity = entity;
-    item->timeout = timeout > 0 ? timeout : worker->conf.default_timeout;
+    item->timeout = timeout < 0 ? worker->conf.default_timeout : 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 1382781..30792fa 100644
--- a/src/misc/background_worker.h
+++ b/src/misc/background_worker.h
@@ -142,8 +142,9 @@ void background_worker_RequestProbe( struct background_worker* worker );
  * \param worker the background-worker
  * \param entity the entity which is to be queued
  * \param id a value suitable for identifying the entity, or `NULL`
- * \param timeout the timeout of the entity in milliseconds, if `0` the
- *        default-timeout of the background-worker will be used.
+ * \param timeout the timeout of the entity in milliseconds, `0` denotes no
+ *                timeout, a negative value will use the default timeout
+ *                associated with the background-worker.
  * \return VLC_SUCCESS if the entity was successfully queued, an error-code on
  *         failure.
  **/



More information about the vlc-commits mailing list