On Mon, 17 Feb 2014, Diego Biurrun wrote:

---

Now setting explicit dependencies for w32threads.

configure          | 1 +
libavutil/atomic.c | 6 +-----
2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index 292da47..841c39a 100755
--- a/configure
+++ b/configure
@@ -1606,6 +1606,7 @@ atomics_gcc_if="sync_val_compare_and_swap"
atomics_suncc_if="atomic_cas_ptr machine_rw_barrier"
atomics_win32_if="MemoryBarrier"
atomics_native_if_any="$ATOMICS_LIST"
+w32threads_deps="atomics_native"
threads_if_any="$THREADS_LIST"

# subsystems

This part is ok with me

diff --git a/libavutil/atomic.c b/libavutil/atomic.c
index e4fa957..38e998e 100644
--- a/libavutil/atomic.c
+++ b/libavutil/atomic.c
@@ -70,7 +70,7 @@ void *avpriv_atomic_ptr_cas(void * volatile *ptr, void 
*oldval, void *newval)
    return ret;
}

-#elif !HAVE_THREADS
+#else

int avpriv_atomic_int_get(volatile int *ptr)
{
@@ -97,10 +97,6 @@ void *avpriv_atomic_ptr_cas(void * volatile *ptr, void 
*oldval, void *newval)
    return *ptr;
}

-#else
-
-#error "Threading is enabled, but there is no implementation of atomic operations 
available"
-
#endif /* HAVE_PTHREADS */

#endif /* !HAVE_ATOMICS_NATIVE */
--
1.8.3.2

I think it would make sense to keep this. At the moment there should not be any configuration where this is triggerable, but for the potential future case of adding a new threading implementation, it's better to catch it with this #error than to silently end up with a bad build.

As for the other question, where to document the fact that you need to add the atomics_native dependency to new threading implementations - this could be one place. The one that adds such an implementation might be one who actually runs into this #error, and a comment next to it might point him in the right direction.

A second place would be somewhere in configure that you would have to look at in order to add a new threading implementation, such as next to the definition of THREADS_LIST, although it would feel horribly out of place there as well.

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to