[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/tls.c Makefile
Lauro Ramos Venancio
lauro.venancio at gmail.com
Wed Apr 11 11:57:03 PDT 2007
Changes in directory llvm-test/SingleSource/UnitTests:
tls.c added (r1.1)
Makefile updated: 1.14 -> 1.15
---
Log message:
Add a TLS test.
---
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
More information about the llvm-commits
mailing list