[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Threads/Makefile tls.c
Chris Lattner
clattner at apple.com
Mon Apr 16 09:42:59 PDT 2007
Thanks Lauro!
-Chris
On Apr 16, 2007, at 9:39 AM, Lauro Ramos Venancio wrote:
>
>
> Changes in directory llvm-test/SingleSource/UnitTests/Threads:
>
> Makefile added (r1.1)
> tls.c added (r1.1)
> ---
> Log message:
>
> Move TLS test to Threads directory.
>
>
> ---
> Diffs of the changes: (+27 -0)
>
> Makefile | 7 +++++++
> tls.c | 20 ++++++++++++++++++++
> 2 files changed, 27 insertions(+)
>
>
> Index: llvm-test/SingleSource/UnitTests/Threads/Makefile
> diff -c /dev/null llvm-test/SingleSource/UnitTests/Threads/Makefile:
> 1.1
> *** /dev/null Mon Apr 16 11:38:41 2007
> --- llvm-test/SingleSource/UnitTests/Threads/Makefile Mon Apr 16
> 11:38:31 2007
> ***************
> *** 0 ****
> --- 1,7 ----
> + # SingleSource/UnitTests/Threads/Makefile
> + LEVEL = ../../..
> +
> + include $(LEVEL)/Makefile.config
> + LDFLAGS += -lpthread
> +
> + include $(LEVEL)/SingleSource/Makefile.singlesrc
>
>
> Index: llvm-test/SingleSource/UnitTests/Threads/tls.c
> diff -c /dev/null llvm-test/SingleSource/UnitTests/Threads/tls.c:1.1
> *** /dev/null Mon Apr 16 11:39:03 2007
> --- llvm-test/SingleSource/UnitTests/Threads/tls.c Mon Apr 16
> 11:38:31 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;
> + }
>
>
>
> _______________________________________________
> 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