failure to post a function is not fatal unless we wrote part of a command (should be impossible)

Former-commit-id: e1c642a033ab0157a66571189e81817cb84fd421
This commit is contained in:
John Sully 2020-01-28 21:41:56 -05:00
parent e54be2c065
commit 5da19e0206

View File

@ -130,6 +130,7 @@ struct aeCommand
void *clientData; void *clientData;
aeCommandControl *pctl; aeCommandControl *pctl;
}; };
static_assert(sizeof(aeCommand) <= PIPE_BUF);
void aeProcessCmd(aeEventLoop *eventLoop, int fd, void *, int ) void aeProcessCmd(aeEventLoop *eventLoop, int fd, void *, int )
{ {
@ -296,7 +297,10 @@ int aePostFunction(aeEventLoop *eventLoop, std::function<void()> fn, bool fSynch
} }
auto size = write(eventLoop->fdCmdWrite, &cmd, sizeof(cmd)); auto size = write(eventLoop->fdCmdWrite, &cmd, sizeof(cmd));
AE_ASSERT(size == sizeof(cmd)); AE_ASSERT(!size || size == sizeof(cmd));
if (size == 0)
return AE_ERR;
int ret = AE_OK; int ret = AE_OK;
if (fSynchronous) if (fSynchronous)
{ {