Commit b165cfea authored by Ronan Abhamon's avatar Ronan Abhamon

fix(src/externals/single-application/SingleApplication): coding style

parent 32e737fc
...@@ -389,32 +389,35 @@ SingleApplication::SingleApplication (int &argc, char *argv[], bool allowSeconda ...@@ -389,32 +389,35 @@ SingleApplication::SingleApplication (int &argc, char *argv[], bool allowSeconda
if (d->memory->create(sizeof(InstancesInfo))) { if (d->memory->create(sizeof(InstancesInfo))) {
d->startPrimary(true); d->startPrimary(true);
return; return;
} else { }
// Attempt to attach to the memory segment
if (d->memory->attach()) {
d->memory->lock();
InstancesInfo *inst = static_cast<InstancesInfo *>(d->memory->data());
if (!inst->primary) {
d->startPrimary(false);
d->memory->unlock();
return;
}
// Check if another instance can be started // Attempt to attach to the memory segment
if (allowSecondary) { if (d->memory->attach()) {
inst->secondary += 1; d->memory->lock();
d->instanceNumber = inst->secondary;
d->startSecondary(); InstancesInfo *inst = static_cast<InstancesInfo *>(d->memory->data());
if (d->options & Mode::SecondaryNotification) {
d->connectToPrimary(timeout, SecondaryInstance);
}
d->memory->unlock();
return;
}
if (!inst->primary) {
d->startPrimary(false);
d->memory->unlock(); d->memory->unlock();
return;
} }
// Check if another instance can be started
if (allowSecondary) {
inst->secondary += 1;
d->instanceNumber = inst->secondary;
d->startSecondary();
if (d->options & Mode::SecondaryNotification)
d->connectToPrimary(timeout, SecondaryInstance);
d->memory->unlock();
return;
}
d->memory->unlock();
} }
d->connectToPrimary(timeout, NewInstance); d->connectToPrimary(timeout, NewInstance);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment