<!DOCTYPE html><html><head><title></title><style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div>OK for this renaming.<br></div><div><br></div><div>On Tue, Feb 4, 2020, at 09:10, Rémi Denis-Courmont wrote:<br></div><blockquote type="cite" id="qt"><div>Hi,<br></div><div><br></div><div>They are not implemented on non-Linux non-Windows as of yet. Exposing them would break libvlccore linking on macos.<br></div><div><br></div><div class="qt-gmail_quote"><div>Le 4 février 2020 09:41:03 GMT+02:00, Steve Lhomme <robux4@ycbcr.xyz> a écrit :<br></div><blockquote style="margin-top:0pt;margin-right:0pt;margin-bottom:0pt;margin-left:0.8ex;border-left-color:rgb(204, 204, 204);border-left-style:solid;border-left-width:1px;padding-left:1ex;" class="qt-gmail_quote"><pre class="qt-k9mail"><div>Looks OK to me.<br></div><div>I'm suprised these are only used by the core and don't have VLC_API. <br></div><div>Shouldn't parts of the header be moved in the core then ? Or should <br></div><div>these APIs be made available to anyone ?<br></div><div><br></div><div>On 2020-02-03 20:35, Rémi Denis-Courmont wrote:<br></div><blockquote style="margin-top:0pt;margin-right:0pt;margin-bottom:1ex;margin-left:0.8ex;border-left-color:rgb(114, 159, 207);border-left-style:solid;border-left-width:1px;padding-left:1ex;" class="qt-gmail_quote"><div>Use C++20 draft-like names instead of custom neither-Linux-nor-Windows<br></div><div>ones.<br></div><div><br></div><div>Note though that C++ has no timed variant for its atomic wait method.<hr>  include/vlc_threads.h | 20 +++++++++++---------<br></div><div>  src/android/thread.c  |  2 +-<br></div><div>  src/linux/thread.c    |  8 ++++----<br></div><div>  src/misc/threads.c    | 10 +++++-----<br></div><div>  src/win32/thread.c    | 10 +++++-----<br></div><div>  5 files changed, 26 insertions(+), 24 deletions(-)<br></div><div><br></div><div>diff --git a/include/vlc_threads.h b/include/vlc_threads.h<br></div><div>index 315729a097..8a39c61087 100644<br></div><div>--- a/include/vlc_threads.h<br></div><div>+++ b/include/vlc_threads.h<br></div><div>@@ -688,19 +688,20 @@ VLC_API void *vlc_threadvar_get(vlc_threadvar_t);<br></div><div>   *<br></div><div>   * Puts the calling thread to sleep if a specific value is stored at a<br></div><div>   * specified address. The thread will sleep until it is woken up by a call to<br></div><div>- * vlc_addr_signal() or vlc_addr_broadcast() in another thread, or spuriously.<br></div><div>+ * vlc_atomic_notify_one() or vlc_atomic_notify_all() in another thread, or<br></div><div>+ * spuriously.<br></div><div>   *<br></div><div>   * If the value does not match, do nothing and return immediately.<br></div><div>   *<br></div><div>   * \param addr address to check for<br></div><div>   * \param val value to match at the address<br></div><div>   */<br></div><div>-void vlc_addr_wait(void *addr, unsigned val);<br></div><div>+void vlc_atomic_wait(void *addr, unsigned val);<br></div><div>  <br></div><div>  /**<br></div><div>   * Waits on an address with a time-out.<br></div><div>   *<br></div><div>- * This function operates as vlc_addr_wait() but provides an additional<br></div><div>+ * This function operates as vlc_atomic_wait() but provides an additional<br></div><div>   * time-out. If the time-out elapses, the thread resumes and the function<br></div><div>   * returns.<br></div><div>   *<br></div><div>@@ -711,30 +712,31 @@ void vlc_addr_wait(void *addr, unsigned val);<br></div><div>   * \return true if the function was woken up before the time-out,<br></div><div>   * false if the time-out elapsed.<br></div><div>   */<br></div><div>-bool vlc_addr_timedwait(void *addr, unsigned val, vlc_tick_t delay);<br></div><div>+bool vlc_atomic_timedwait(void *addr, unsigned val, vlc_tick_t delay);<br></div><div>  <br></div><div>  /**<br></div><div>   * Wakes up one thread on an address.<br></div><div>   *<br></div><div>   * Wakes up (at least) one of the thread sleeping on the specified address.<br></div><div>   * The address must be equal to the first parameter given by at least one<br></div><div>- * thread sleeping within the vlc_addr_wait() or vlc_addr_timedwait()<br></div><div>+ * thread sleeping within the vlc_atomic_wait() or vlc_atomic_timedwait()<br></div><div>   * functions. If no threads are found, this function does nothing.<br></div><div>   *<br></div><div>   * \param addr address identifying which threads may be woken up<br></div><div>   */<br></div><div>-void vlc_addr_signal(void *addr);<br></div><div>+void vlc_atomic_notify_one(void *addr);<br></div><div>  <br></div><div>  /**<br></div><div>   * Wakes up all thread on an address.<br></div><div>   *<br></div><div>   * Wakes up all threads sleeping on the specified address (if any).<br></div><div>- * Any thread sleeping within a call to vlc_addr_wait() or vlc_addr_timedwait()<br></div><div>- * with the specified address as first call parameter will be woken up.<br></div><div>+ * Any thread sleeping within a call to vlc_atomic_wait() or<br></div><div>+ * vlc_atomic_timedwait() with the specified address as first call parameter<br></div><div>+ * will be woken up.<br></div><div>   *<br></div><div>   * \param addr address identifying which threads to wake up<br></div><div>   */<br></div><div>-void vlc_addr_broadcast(void *addr);<br></div><div>+void vlc_atomic_notify_all(void *addr);<br></div><div>  <br></div><div>  /**<br></div><div>   * Creates and starts a new thread.<br></div><div>diff --git a/src/android/thread.c b/src/android/thread.c<br></div><div>index 0d9191592e..ca715418d4 100644<br></div><div>--- a/src/android/thread.c<br></div><div>+++ b/src/android/thread.c<br></div><div>@@ -293,7 +293,7 @@ void vlc_cancel (vlc_thread_t thread_id)<br></div><div>      if (addr != NULL)<br></div><div>      {<br></div><div>          atomic_fetch_or_explicit(addr, 1, memory_order_relaxed);<br></div><div>-        vlc_addr_broadcast(addr);<br></div><div>+        vlc_atomic_notify_all(addr);<br></div><div>      }<br></div><div>      vlc_mutex_unlock(&thread_id->wait.lock);<br></div><div>  }<br></div><div>diff --git a/src/linux/thread.c b/src/linux/thread.c<br></div><div>index 7e9dab63bd..5a89cfa44a 100644<br></div><div>--- a/src/linux/thread.c<br></div><div>+++ b/src/linux/thread.c<br></div><div>@@ -68,22 +68,22 @@ static int vlc_futex_wait(void *addr, unsigned val, const struct timespec *to)<br></div><div>      return ret;<br></div><div>  }<br></div><div>  <br></div><div>-void vlc_addr_signal(void *addr)<br></div><div>+void vlc_atomic_notify_one(void *addr)<br></div><div>  {<br></div><div>      vlc_futex_wake(addr, 1);<br></div><div>  }<br></div><div>  <br></div><div>-void vlc_addr_broadcast(void *addr)<br></div><div>+void vlc_atomic_notify_all(void *addr)<br></div><div>  {<br></div><div>      vlc_futex_wake(addr, INT_MAX);<br></div><div>  }<br></div><div>  <br></div><div>-void vlc_addr_wait(void *addr, unsigned val)<br></div><div>+void vlc_atomic_wait(void *addr, unsigned val)<br></div><div>  {<br></div><div>      vlc_futex_wait(addr, val, NULL);<br></div><div>  }<br></div><div>  <br></div><div>-bool vlc_addr_timedwait(void *addr, unsigned val, vlc_tick_t delay)<br></div><div>+bool vlc_atomic_timedwait(void *addr, unsigned val, vlc_tick_t delay)<br></div><div>  {<br></div><div>      struct timespec ts = timespec_from_vlc_tick(delay);<br></div><div>  <br></div><div>diff --git a/src/misc/threads.c b/src/misc/threads.c<br></div><div>index d267cc7344..501a17ac9b 100644<br></div><div>--- a/src/misc/threads.c<br></div><div>+++ b/src/misc/threads.c<br></div><div>@@ -177,7 +177,7 @@ void (vlc_tick_wait)(vlc_tick_t deadline)<br></div><div>  <br></div><div>      while ((delay = (deadline - vlc_tick_now())) > 0)<br></div><div>      {<br></div><div>-        vlc_addr_timedwait(&value, 0, delay);<br></div><div>+        vlc_atomic_timedwait(&value, 0, delay);<br></div><div>          vlc_testcancel();<br></div><div>      }<br></div><div>  <br></div><div>@@ -236,13 +236,13 @@ void vlc_cond_signal(vlc_cond_t *cond)<br></div><div>       * - cnd_wait() sets the futex to the equal-or-next even value.<br></div><div>       **/<br></div><div>      atomic_fetch_or_explicit(vlc_cond_value(cond), 1, memory_order_relaxed);<br></div><div>-    vlc_addr_signal(&cond->value);<br></div><div>+    vlc_atomic_notify_one(&cond->value);<br></div><div>  }<br></div><div>  <br></div><div>  void vlc_cond_broadcast(vlc_cond_t *cond)<br></div><div>  {<br></div><div>      atomic_fetch_or_explicit(vlc_cond_value(cond), 1, memory_order_relaxed);<br></div><div>-    vlc_addr_broadcast(&cond->value);<br></div><div>+    vlc_atomic_notify_all(&cond->value);<br></div><div>  }<br></div><div>  <br></div><div>  void vlc_cond_wait(vlc_cond_t *cond, vlc_mutex_t *mutex)<br></div><div>@@ -261,7 +261,7 @@ void vlc_cond_wait(vlc_cond_t *cond, vlc_mutex_t *mutex)<br></div><div>      vlc_cancel_addr_prepare(&cond->value);<br></div><div>      vlc_mutex_unlock(mutex);<br></div><div>  <br></div><div>-    vlc_addr_wait(&cond->value, value);<br></div><div>+    vlc_atomic_wait(&cond->value, value);<br></div><div>  <br></div><div>      vlc_mutex_lock(mutex);<br></div><div>      vlc_cancel_addr_finish(&cond->value);<br></div><div>@@ -285,7 +285,7 @@ static int vlc_cond_wait_delay(vlc_cond_t *cond, vlc_mutex_t *mutex,<br></div><div>      vlc_mutex_unlock(mutex);<br></div><div>  <br></div><div>      if (delay > 0)<br></div><div>-        value = vlc_addr_timedwait(&cond->value, value, delay);<br></div><div>+        value = vlc_atomic_timedwait(&cond->value, value, delay);<br></div><div>      else<br></div><div>          value = 0;<br></div><div>  <br></div><div>diff --git a/src/win32/thread.c b/src/win32/thread.c<br></div><div>index d4fc433cae..07423af530 100644<br></div><div>--- a/src/win32/thread.c<br></div><div>+++ b/src/win32/thread.c<br></div><div>@@ -424,12 +424,12 @@ static void WINAPI WakeByAddressFallback(void *addr)<br></div><div>  }<br></div><div>  #endif<br></div><div>  <br></div><div>-void vlc_addr_wait(void *addr, unsigned val)<br></div><div>+void vlc_atomic_wait(void *addr, unsigned val)<br></div><div>  {<br></div><div>      WaitOnAddress(addr, &val, sizeof (val), -1);<br></div><div>  }<br></div><div>  <br></div><div>-bool vlc_addr_timedwait(void *addr, unsigned val, vlc_tick_t delay)<br></div><div>+bool vlc_atomic_timedwait(void *addr, unsigned val, vlc_tick_t delay)<br></div><div>  {<br></div><div>      delay = (delay + (1000-1)) / 1000;<br></div><div>  <br></div><div>@@ -442,12 +442,12 @@ bool vlc_addr_timedwait(void *addr, unsigned val, vlc_tick_t delay)<br></div><div>      return WaitOnAddress(addr, &val, sizeof (val), delay);<br></div><div>  }<br></div><div>  <br></div><div>-void vlc_addr_signal(void *addr)<br></div><div>+void vlc_atomic_notify_one(void *addr)<br></div><div>  {<br></div><div>      WakeByAddressSingle(addr);<br></div><div>  }<br></div><div>  <br></div><div>-void vlc_addr_broadcast(void *addr)<br></div><div>+void vlc_atomic_notify_all(void *addr)<br></div><div>  {<br></div><div>      WakeByAddressAll(addr);<br></div><div>  }<br></div><div>@@ -585,7 +585,7 @@ void vlc_cancel (vlc_thread_t th)<br></div><div>      if (th->wait.addr != NULL)<br></div><div>      {<br></div><div>          atomic_fetch_or_explicit(th->wait.addr, 1, memory_order_relaxed);<br></div><div>-        vlc_addr_broadcast(th->wait.addr);<br></div><div>+        vlc_atomic_notify_all(th->wait.addr);<br></div><div>      }<br></div><div>      LeaveCriticalSection(&th->wait.lock);<br></div><div>  <br></div><div>-- <br></div><div>2.25.0<hr>vlc-devel mailing list<br></div><div>To unsubscribe or modify your subscription options:<br></div><div><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></div></blockquote><div><hr>vlc-devel mailing list<br></div><div>To unsubscribe or modify your subscription options:<br></div><div><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></div></pre></blockquote></div><div><br></div><div>-- <br></div><div>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté. <br></div><div>_______________________________________________<br></div><div>vlc-devel mailing list<br></div><div>To unsubscribe or modify your subscription options:<br></div><div>https://mailman.videolan.org/listinfo/vlc-devel<br></div></blockquote><div><br></div></body></html>