Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'valgrind/org.eclipse.linuxtools.valgrind.helgrind.tests/resources/basicTest/test.c')
-rw-r--r--valgrind/org.eclipse.linuxtools.valgrind.helgrind.tests/resources/basicTest/test.c58
1 files changed, 40 insertions, 18 deletions
diff --git a/valgrind/org.eclipse.linuxtools.valgrind.helgrind.tests/resources/basicTest/test.c b/valgrind/org.eclipse.linuxtools.valgrind.helgrind.tests/resources/basicTest/test.c
index b70783fd0a..3d5fdae700 100644
--- a/valgrind/org.eclipse.linuxtools.valgrind.helgrind.tests/resources/basicTest/test.c
+++ b/valgrind/org.eclipse.linuxtools.valgrind.helgrind.tests/resources/basicTest/test.c
@@ -1,19 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Elliott Baron <ebaron@redhat.com> - initial API and implementation
- *******************************************************************************/
-#include <stdlib.h>
-
-#define SIZE 10
-int main() {
- char *waste = (char *)malloc(sizeof(char) * SIZE);
- waste[0] = waste[SIZE];
- waste[SIZE] = 0;
- return 0;
+#include <stdio.h>
+#include <pthread.h>
+
+pthread_t thread;
+
+void* thread3 (void* d)
+{
+ int count3 = 0;
+
+ while(count3 < 100){
+ printf("Thread 3: %d\n", count3++);
+ }
+ return NULL;
+}
+
+void* thread2 (void* d)
+{
+ int count2 = 0;
+
+ while(count2 < 1000){
+ //
+ printf("Thread 2: %d\n", count2++);
+ }
+ return NULL;
+}
+
+int main (){
+
+ pthread_create (&thread, NULL, thread2, NULL);
+ pthread_create (&thread, NULL, thread3, NULL);
+
+ //Thread 1
+ int count1 = 0;
+
+ while(count1 < 10){
+ printf("Thread 1: %d\n", count1++);
+ }
+
+ pthread_join(thread,NULL);
+ return 0;
}

Back to the top