[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/tls.c Makefile

Chris Lattner clattner at apple.com
Sat Apr 14 12:45:35 PDT 2007


On Apr 11, 2007, at 11:57 AM, Lauro Ramos Venancio wrote:
> Add a TLS test.

Hi Lauro, can you please add a "Threads" subdirectory of UnitTests  
and move this testcase there?  That way we won't be linking all  
UnitTests with -lpthreads.

Thanks!

-Chris

>
> ---
> Diffs of the changes:  (+21 -0)
>
>  Makefile |    1 +
>  tls.c    |   20 ++++++++++++++++++++
>  2 files changed, 21 insertions(+)
>
>
> Index: llvm-test/SingleSource/UnitTests/tls.c
> diff -c /dev/null llvm-test/SingleSource/UnitTests/tls.c:1.1
> *** /dev/null	Wed Apr 11 13:56:56 2007
> --- llvm-test/SingleSource/UnitTests/tls.c	Wed Apr 11 13:56:46 2007
> ***************
> *** 0 ****
> --- 1,20 ----
> + #include <stdio.h>
> + #include <pthread.h>
> +
> + void *f(void *a){
> +   static __thread int i = 1;
> +   i++;
> +   return (void *)i;
> + }
> +
> + int main() {
> +   pthread_t t;
> +   int ret;
> +   pthread_create(&t, NULL, f, NULL);
> +   pthread_join(t, (void **) &ret);
> +   printf("Thread 1: %d\n",ret);
> +   pthread_create(&t, NULL, f, NULL);
> +   pthread_join(t, (void **) &ret);
> +   printf("Thread 2: %d\n",ret);
> +   return 0;
> + }
>
>
> Index: llvm-test/SingleSource/UnitTests/Makefile
> diff -u llvm-test/SingleSource/UnitTests/Makefile:1.14 llvm-test/ 
> SingleSource/UnitTests/Makefile:1.15
> --- llvm-test/SingleSource/UnitTests/Makefile:1.14	Tue Apr 10  
> 18:52:47 2007
> +++ llvm-test/SingleSource/UnitTests/Makefile	Wed Apr 11 13:56:46 2007
> @@ -15,5 +15,6 @@
>
>  DIRS += SignlessTypes
>
> +LDFLAGS += -lpthread
>  PROGRAM_REQUIRED_TO_EXIT_OK := 1
>  include $(LEVEL)/SingleSource/Makefile.singlesrc
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list