qTox
Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
|
Inter-process communication. More...
#include <ipc.h>
Classes | |
struct | IPCEvent |
struct | IPCMemory |
Public Slots | |
void | setProfileId (uint32_t profileId) |
Public Member Functions | |
IPC (uint32_t profileId) | |
~IPC () | |
time_t | postEvent (const QString &name, const QByteArray &data=QByteArray(), uint32_t dest=0) |
Post IPC event. More... | |
bool | isCurrentOwner () |
void | registerEventHandler (const QString &name, IPCEventHandler handler) |
Register a handler for an IPC event. More... | |
bool | isEventAccepted (time_t time) |
bool | waitUntilAccepted (time_t time, int32_t timeout=-1) |
bool | isAttached () const |
Static Protected Attributes | |
static const int | EVENT_TIMER_MS = 1000 |
static const int | EVENT_GC_TIMEOUT = 5 |
static const int | EVENT_QUEUE_SIZE = 32 |
static const int | OWNERSHIP_TIMEOUT_S = 5 |
Private Member Functions | |
IPCMemory * | global () |
bool | runEventHandler (IPCEventHandler handler, const QByteArray &arg) |
IPCEvent * | fetchEvent () |
Only called when global memory IS LOCKED. More... | |
void | processEvents () |
bool | isCurrentOwnerNoLock () |
Only called when global memory IS LOCKED. More... | |
Private Attributes | |
QTimer | timer |
uint64_t | globalId |
uint32_t | profileId |
QSharedMemory | globalMemory |
QMap< QString, IPCEventHandler > | eventHandlers |
|
private |
|
private |
bool IPC::isAttached | ( | ) | const |
bool IPC::isCurrentOwner | ( | ) |
|
private |
bool IPC::isEventAccepted | ( | time_t | time | ) |
time_t IPC::postEvent | ( | const QString & | name, |
const QByteArray & | data = QByteArray() , |
||
uint32_t | dest = 0 |
||
) |
Post IPC event.
name | Name to set in IPC event. |
data | Data to set in IPC event (default QByteArray()). |
dest | Settings::getCurrentProfileId() or 0 (main instance, default). |
Definition at line 136 of file ipc.cpp.
|
private |
void IPC::registerEventHandler | ( | const QString & | name, |
IPCEventHandler | handler | ||
) |
|
private |
|
slot |
bool IPC::waitUntilAccepted | ( | time_t | time, |
int32_t | timeout = -1 |
||
) |
|
private |