Skip to content

Commit

Permalink
Mute an UBSan check error for SCOPED_LOCK macro (#283)
Browse files Browse the repository at this point in the history
  • Loading branch information
beef9999 committed Dec 5, 2023
1 parent c56e07d commit 9841397
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions thread/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ inline int posix_memalign(void** memptr, size_t alignment, size_t size) {
by target vcpu in resume_thread(), when its runq becomes empty;
*/

#define SCOPED_MEMBER_LOCK(x) SCOPED_LOCK(&(x)->lock, ((bool)x) * 2)

// Define assembly section header for clang and gcc
#if defined(__APPLE__)
#define DEF_ASM_FUNC(name) ".text\n" \
Expand Down Expand Up @@ -1199,7 +1197,8 @@ R"(
__attribute__((always_inline)) inline
Switch prepare_usleep(uint64_t useconds, thread_list* waitq, RunQ rq = {})
{
SCOPED_MEMBER_LOCK(waitq);
spinlock* waitq_lock = waitq ? &waitq->lock : nullptr;
SCOPED_LOCK(waitq_lock, ((bool) waitq) * 2);
SCOPED_LOCK(rq.current->lock);
assert(!AtomicRunQ(rq).single());
auto sw = AtomicRunQ(rq).remove_current(states::SLEEPING);
Expand Down

0 comments on commit 9841397

Please sign in to comment.