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