forked from rr-debugger/rr
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Catch bugs that require starting a high-priority-only interval right …
…at the start of the application
- Loading branch information
1 parent
08357f6
commit 04c5add
Showing
5 changed files
with
80 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* -*- Mode: C; tab-width: 8; c-basic-offset: 2; indent-tabs-mode: nil; -*- */ | ||
|
||
#include "chaosutil.h" | ||
|
||
static int flag; | ||
static pthread_mutex_t mutex; | ||
|
||
static void* run_thread(__attribute__((unused)) void* p) { | ||
struct timespec ts = { 1, 0 }; | ||
nanosleep(&ts, NULL); | ||
pthread_mutex_lock(&mutex); | ||
flag = 1; | ||
pthread_mutex_unlock(&mutex); | ||
return NULL; | ||
} | ||
|
||
int main(void) { | ||
int i; | ||
pthread_t thread; | ||
|
||
pthread_mutex_init(&mutex, NULL); | ||
pthread_create(&thread, NULL, run_thread, NULL); | ||
pthread_mutex_lock(&mutex); | ||
if (flag > 0) { | ||
caught_test_failure("flag set"); | ||
} | ||
pthread_mutex_unlock(&mutex); | ||
pthread_join(thread, NULL); | ||
|
||
atomic_puts("EXIT-SUCCESS"); | ||
return 0; | ||
} |