Skip to content

Commit

Permalink
Minor changes to nontermination_weak.c benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasHaas committed Dec 10, 2024
1 parent 8d0ca46 commit 768b090
Show file tree
Hide file tree
Showing 3 changed files with 188 additions and 126 deletions.
15 changes: 12 additions & 3 deletions benchmarks/nontermination/nontermination_weak.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,30 @@
volatile int x = 0;
atomic_int signal = 0;
atomic_int success = 0;
atomic_int sendAgain = 0;

void *thread(void *unused)
{
while(!success) {
while(1) {
x = 1;
atomic_store_explicit(&signal, 1, memory_order_relaxed);
// Wait for acknowledgement
while (!sendAgain && !success) { }
if (sendAgain) {
// Reset message, then try again
x = 0;
sendAgain = 0;
}
if (success) break;
}
return 0;
}

void *thread2(void *unused) {
while (atomic_load_explicit(&signal, memory_order_relaxed) == 1 && x == 0) {
// Message was wrong, reset and wait for new one.
x = 0;
// Message was wrong, ask for a new message
signal = 0;
sendAgain = 1;
}
success = 1;
return 0;
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/progress/progressUnfair.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
#include <assert.h>
#include <stdatomic.h>

atomic_int x = 0;

// Required progress: Unfair (terminates under all progress models)

atomic_int x = 0;

void *thread_1(void *unused)
{
while (x != 1);
Expand Down
Loading

0 comments on commit 768b090

Please sign in to comment.