Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Scope 'a' and create another object to use later in the atomic_ref wa…
Browse files Browse the repository at this point in the history
…it test
  • Loading branch information
wmaxey committed Feb 28, 2023
1 parent 6494e4d commit 6378179
Showing 1 changed file with 22 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,36 @@ struct TestFn {
__shared__
#endif
T * t;
{
#ifdef __CUDA_ARCH__
if (threadIdx.x == 0) {
if (threadIdx.x == 0) {
#endif
t = (T *)malloc(sizeof(A));
A a(*t);
a.store(T(1));
assert(a.load() == T(1));
a.wait(T(0));
t = (T *)malloc(sizeof(A));
A a(*t);
a.store(T(1));
assert(a.load() == T(1));
a.wait(T(0));
#ifdef __CUDA_ARCH__
}
}
__syncthreads();
#endif
}


auto agent_notify = LAMBDA (){
a.store(T(3));
a.notify_one();;
};
{
A a(*t);

auto agent_wait = LAMBDA (){
a.wait(T(1));
};
auto agent_notify = LAMBDA (){
a.store(T(3));
a.notify_one();
};

concurrent_agents_launch(agent_notify, agent_wait);
auto agent_wait = LAMBDA (){
a.wait(T(1));
};

concurrent_agents_launch(agent_notify, agent_wait);
}
}
};

Expand Down

0 comments on commit 6378179

Please sign in to comment.