This commit is contained in:
zhuzichu 2023-04-22 18:01:52 +08:00
parent a27e5db032
commit a4398d1a2f

View File

@ -6,9 +6,7 @@
#include <ctime> #include <ctime>
#include <random> #include <random>
#ifdef WIN32 #ifndef _MSC_VER
#include <windows.h>
#else
#include <unistd.h> #include <unistd.h>
#endif #endif
@ -90,7 +88,7 @@ time_t IPC::postEvent(const QString& name, const QByteArray& data, uint32_t dest
memcpy(evt->data, data.constData(), data.length()); memcpy(evt->data, data.constData(), data.length());
mem->lastEvent = evt->posted = result = qMax(mem->lastEvent + 1, time(nullptr)); mem->lastEvent = evt->posted = result = qMax(mem->lastEvent + 1, time(nullptr));
evt->dest = dest; evt->dest = dest;
evt->sender = GetCurrentProcessId(); evt->sender = _getpid();
qDebug() << "postEvent " << name << "to" << dest; qDebug() << "postEvent " << name << "to" << dest;
} }
globalMemory.unlock(); globalMemory.unlock();
@ -172,7 +170,7 @@ IPC::IPCEvent* IPC::fetchEvent()
memset(evt, 0, sizeof(IPCEvent)); memset(evt, 0, sizeof(IPCEvent));
} }
if (evt->posted && !evt->processed && evt->sender != GetCurrentProcessId() if (evt->posted && !evt->processed && evt->sender != _getpid()
&& (evt->dest == profileId || (evt->dest == 0 && isCurrentOwnerNoLock()))) { && (evt->dest == profileId || (evt->dest == 0 && isCurrentOwnerNoLock()))) {
return evt; return evt;
} }