forked from OSchip/llvm-project
parent
86b75a4057
commit
49a040a483
|
@ -1,10 +1,12 @@
|
|||
// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t 2>&1 | FileCheck %s
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int Global;
|
||||
|
||||
void *Thread1(void *x) {
|
||||
sleep(1);
|
||||
Global++;
|
||||
return NULL;
|
||||
}
|
||||
|
@ -20,6 +22,7 @@ int main() {
|
|||
pthread_create(&t[1], NULL, Thread2, NULL);
|
||||
pthread_join(t[0], NULL);
|
||||
pthread_join(t[1], NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// CHECK: WARNING: ThreadSanitizer: data race
|
||||
|
|
Loading…
Reference in New Issue