Correct total size of Semaphore to be 64

Change-Id: I20db76eab06fc8a0b3869348c537e7303dfa6466


[ROCm/clr commit: dabda131bd]
Cette révision appartient à :
Matt Arsenault
2020-07-06 10:34:30 -04:00
révisé par Matthew Arsenault
Parent 3cae0b7649
révision b39da2994f
+9 -2
Voir le fichier
@@ -46,12 +46,16 @@ class Semaphore : public HeapObject {
private:
std::atomic_int state_; //!< This semaphore's value.
// The base class size is 1, so padding alignment is needed.
static constexpr size_t state_size = sizeof(std::atomic_int) +
alignof(std::atomic_int);
#ifdef _WIN32
void* handle_; //!< The semaphore object's handle.
char padding_[64 - sizeof(void*) - sizeof(std::atomic_int)];
char padding_[64 - state_size - sizeof(handle_))];
#else // !_WIN32
sem_t sem_; //!< The semaphore object's identifier.
char padding_[64 - sizeof(sem_t) - sizeof(std::atomic_int)];
char padding_[64 - state_size - sizeof(sem_)];
#endif /*!_WIN32*/
public:
@@ -68,6 +72,9 @@ class Semaphore : public HeapObject {
void reset() { state_.store(0, std::memory_order_release); }
};
static_assert(sizeof(Semaphore) == 64 ,
"unexpected total size of Semaphore");
/*! @}
* @}
*/