[host] added IVSHMEM::CreateVectorEvent

This commit is contained in:
Geoffrey McRae 2017-10-31 22:17:27 +11:00
parent 215d2c7a4b
commit 941f0f1c16
2 changed files with 28 additions and 0 deletions

View File

@ -189,4 +189,31 @@ void * IVSHMEM::GetMemory()
m_vectors = static_cast<UINT16>(map.vectors);
return m_memory;
}
HANDLE IVSHMEM::CreateVectorEvent(UINT16 vector)
{
if (!m_initialized)
return INVALID_HANDLE_VALUE;
HANDLE event = CreateEvent(NULL, TRUE, FALSE, NULL);
if (event == INVALID_HANDLE_VALUE)
{
DEBUG_ERROR("CreateEvent Failed: %d", GetLastError());
return INVALID_HANDLE_VALUE;
}
IVSHMEM_EVENT msg;
msg.event = event;
msg.singleShot = false;
msg.vector = vector;
if (!DeviceIoControl(m_handle, IOCTL_IVSHMEM_REGISTER_EVENT, &msg, sizeof(IVSHMEM_EVENT), NULL, 0, NULL, NULL))
{
DEBUG_ERROR("DeviceIoControl Failed: %d", GetLastError());
CloseHandle(event);
return INVALID_HANDLE_VALUE;
}
return event;
}

View File

@ -22,6 +22,7 @@ public:
UINT16 GetPeerID();
UINT16 GetVectors();
void * GetMemory();
HANDLE CreateVectorEvent(UINT16 vector);
protected: