From f7e572b4f4a0339162f8bc168edfd9fa523c9c1e Mon Sep 17 00:00:00 2001 From: Siva Chandra Reddy Date: Mon, 30 Aug 2021 04:08:35 +0000 Subject: [PATCH] [libc][NFC] Add a check to catch mismatch in internal and public mutex types. --- libc/src/threads/linux/Mutex.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libc/src/threads/linux/Mutex.h b/libc/src/threads/linux/Mutex.h index 454b8ced3054b..f6033c92eaf6e 100644 --- a/libc/src/threads/linux/Mutex.h +++ b/libc/src/threads/linux/Mutex.h @@ -107,6 +107,10 @@ struct Mutex { } }; +static_assert(sizeof(Mutex) == sizeof(mtx_t), + "Sizes of internal representation of mutex and the public mtx_t " + "do not match."); + class MutexLock { Mutex *mutex;