20 #include "modules/subsys/posix/IoEvent.h" 21 #include "modules/subsys/posix/PosixSubsystem.h" 22 #include "modules/system/vfs/File.h" 26 static void ioEventHandler(uint8_t *pBuffer);
29 :
Event(0, false), m_pSubsystem(0), m_pFile(0), m_pRetriggerInstance(0)
34 :
Event(reinterpret_cast<uintptr_t>(&ioEventHandler),
false),
35 m_pSubsystem(subsystem), m_pFile(file), m_pRetriggerInstance(0)
46 if (m_pRetriggerInstance)
50 m_pFile->
monitor(pThread, m_pRetriggerInstance);
56 void *alignedBuffer = ASSUME_ALIGNMENT(pBuffer,
sizeof(
size_t));
57 size_t *pBuf =
reinterpret_cast<size_t *
>(alignedBuffer);
58 pBuf[0] = EventNumbers::IoEvent;
59 pBuf[1] =
reinterpret_cast<size_t>(m_pSubsystem);
60 pBuf[2] =
reinterpret_cast<size_t>(m_pFile);
61 pBuf[3] =
reinterpret_cast<size_t>(
this);
63 return 4 *
sizeof(size_t);
66 bool IoEvent::unserialize(uint8_t *pBuffer,
IoEvent &event)
68 void *alignedBuffer = ASSUME_ALIGNMENT(pBuffer,
sizeof(
size_t));
69 size_t *pBuf =
reinterpret_cast<size_t *
>(alignedBuffer);
70 if (pBuf[0] != EventNumbers::IoEvent)
74 event.m_pFile =
reinterpret_cast<File *
>(pBuf[2]);
75 event.m_pRetriggerInstance =
reinterpret_cast<IoEvent *
>(pBuf[3]);
80 void ioEventHandler(uint8_t *pBuffer)
83 if (!IoEvent::unserialize(pBuffer, e))
85 FATAL(
"PollEventHandler: unable to unserialize event!");
void monitor(Thread *pThread, Event *pEvent)
static ProcessorInformation & information()
virtual void sendSignal(Thread *pThread, int signal, bool yield=true)
virtual size_t serialize(uint8_t *pBuffer)
Event(uintptr_t handlerAddress, bool isDeletable, size_t specificNestingLevel=~0UL)