Ensure messages are a multiple of 8

The compiler will anyway insert padding to ensure the size of the
structure is a multiple of 8. That will under Valgrind show up as
writes of uninitialized data when the messages are sent over the
pipe.

Rather than forcing the structure to be aligned on 4 byte boundary
we simply expand the id field to an 8 byte type.
This commit is contained in:
Johan Wikman 2017-05-04 13:09:19 +03:00
parent bcbff5da1b
commit 5de5609692

View File

@ -39,7 +39,7 @@ public:
* @param arg1 First argument.
* @param arg2 Second argument.
*/
explicit MessageQueueMessage(uint32_t id = 0, intptr_t arg1 = 0, intptr_t arg2 = 0)
explicit MessageQueueMessage(uint64_t id = 0, intptr_t arg1 = 0, intptr_t arg2 = 0)
: m_id(id)
, m_arg1(arg1)
, m_arg2(arg2)
@ -61,7 +61,7 @@ public:
return m_arg2;
}
MessageQueueMessage& set_id(uint32_t id)
MessageQueueMessage& set_id(uint64_t id)
{
m_id = id;
return *this;
@ -80,7 +80,7 @@ public:
}
private:
uint32_t m_id;
uint64_t m_id;
intptr_t m_arg1;
intptr_t m_arg2;
};