From c15802af8b0fe433ab349e7647bd56ced3f71855 Mon Sep 17 00:00:00 2001 From: John Sully Date: Mon, 25 May 2020 02:13:57 -0400 Subject: [PATCH] Fix issue #170. Intermittent crash destroying fastlock due to implicit type conversion in assert Former-commit-id: ecbe168b5421687899a621c995e44f43faec2b71 --- src/fastlock.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/fastlock.cpp b/src/fastlock.cpp index cc6eea99a..28092828f 100644 --- a/src/fastlock.cpp +++ b/src/fastlock.cpp @@ -433,8 +433,9 @@ extern "C" void unlock_futex(struct fastlock *lock, uint16_t ifutex) extern "C" void fastlock_free(struct fastlock *lock) { // NOP - serverAssert((lock->m_ticket.m_active == lock->m_ticket.m_avail) // Asser the lock is unlocked - || (lock->m_pidOwner == gettid() && (lock->m_ticket.m_active == lock->m_ticket.m_avail-1))); // OR we own the lock and nobody else is waiting + serverAssert((lock->m_ticket.m_active == lock->m_ticket.m_avail) // Assert the lock is unlocked + || (lock->m_pidOwner == gettid() + && (lock->m_ticket.m_active == static_cast(lock->m_ticket.m_avail-1U)))); // OR we own the lock and nobody else is waiting lock->m_pidOwner = -2; // sentinal value indicating free ANNOTATE_RWLOCK_DESTROY(lock); }