| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 #include <assert.h> | 7 #include <assert.h> |
| 8 #include <pthread.h> | 8 #include <pthread.h> |
| 9 #include <semaphore.h> | 9 #include <semaphore.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 pthread_join(t[i], NULL); | 45 pthread_join(t[i], NULL); |
| 46 } | 46 } |
| 47 } | 47 } |
| 48 | 48 |
| 49 /* Don't let various optimizations (e.g. tail call elimination) to happen. */ | 49 /* Don't let various optimizations (e.g. tail call elimination) to happen. */ |
| 50 NOINLINE void break_optimization(void) { | 50 NOINLINE void break_optimization(void) { |
| 51 #if defined(__pnacl__) | 51 #if defined(__pnacl__) |
| 52 volatile int foo; | 52 volatile int foo; |
| 53 foo = 0; | 53 foo = 0; |
| 54 #else | 54 #else |
| 55 asm volatile (""); | 55 __asm__ volatile (""); |
| 56 #endif | 56 #endif |
| 57 } | 57 } |
| 58 | 58 |
| 59 /* -------------------------------------------------------------------------- */ | 59 /* -------------------------------------------------------------------------- */ |
| 60 /* positive_race_on_global_test | 60 /* positive_race_on_global_test |
| 61 Simle race on a global variable between three threads. | 61 Simle race on a global variable between three threads. |
| 62 We have few stack frames here to test ThreadSanitizer's output. */ | 62 We have few stack frames here to test ThreadSanitizer's output. */ |
| 63 int simple_race_obj; | 63 int simple_race_obj; |
| 64 NOINLINE void simple_race_write_frame_2(void) { | 64 NOINLINE void simple_race_write_frame_2(void) { |
| 65 break_optimization(); | 65 break_optimization(); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 /* -------------------------------------------------------------------------- */ | 233 /* -------------------------------------------------------------------------- */ |
| 234 int main(void) { | 234 int main(void) { |
| 235 if (1) positive_race_on_global_test(); | 235 if (1) positive_race_on_global_test(); |
| 236 if (1) positive_race_on_heap_test(); | 236 if (1) positive_race_on_heap_test(); |
| 237 if (1) positive_wrong_lock_test(); | 237 if (1) positive_wrong_lock_test(); |
| 238 if (1) negative_locked_access_test(); | 238 if (1) negative_locked_access_test(); |
| 239 if (1) negative_posix_sem_test(); | 239 if (1) negative_posix_sem_test(); |
| 240 if (1) thread_create_and_join_test(); | 240 if (1) thread_create_and_join_test(); |
| 241 return 0; | 241 return 0; |
| 242 } | 242 } |
| OLD | NEW |