[vlc-devel] [PATCH] misc/background_worker: allow for indefinite wait (no timeout)
Filip Roséen
filip at atch.se
Tue Apr 4 22:50:08 CEST 2017
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.
---
Thanks to Thomas Guillem for letting me know about the issue.
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 8009a601b1..be4e768abc 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 1382781540..30792fa3ed 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.
**/
--
2.12.1
More information about the vlc-devel
mailing list