On Thu, Dec 01, 2016 at 10:22:24AM -0800, Wan-Teh Chang wrote:
> --- /dev/null
> +++ b/libavutil/tests/cpu_init.c
> @@ -0,0 +1,72 @@
> +int main(int argc, char **argv)
argc and argv are unused.
> +{
> +#if HAVE_PTHREADS
> + int cpu_flags1;
> + int cpu_flags2;
> + int ret;
> + pthread_t thread1;
> + pthread_t thread2;
> +
> + if ((ret = pthread_create(&thread1, NULL, thread_main, &cpu_flags1))) {
> + fprintf(stderr, "pthread_create failed: %s.\n", strerror(ret));
> + return 1;
> + }
> + if ((ret = pthread_create(&thread2, NULL, thread_main, &cpu_flags2))) {
> + fprintf(stderr, "pthread_create failed: %s.\n", strerror(ret));
> + return 1;
> + }
> + pthread_join(thread1, NULL);
> + pthread_join(thread2, NULL);
> +
> + if (cpu_flags1 < 0)
> + return 2;
> + if (cpu_flags2 < 0)
> + return 2;
> + if (cpu_flags1 != cpu_flags2)
> + return 3;
> +#endif
> +
> + return 0;
> +}
It seems a bit silly to have an empty test in the no pthreads case.
I'd suggest building and running the test conditional on pthreads
instead.
Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel