Fixed race condition when disconnecting shared memory client elements.

This commit is contained in:
Thulinma 2014-12-15 18:16:08 +01:00
parent 69bfb3a0be
commit 7e5d7264ae

View file

@ -718,6 +718,7 @@ namespace IPC {
empty = (char *)malloc(payLen * sizeof(char));
memset(empty, 0, payLen);
}
semGuard tmpGuard(&mySemaphore);
unsigned int id = 0;
for (std::set<sharedPage>::iterator it = myPages.begin(); it != myPages.end(); it++) {
if (!it->mapped || !it->len) {
@ -915,6 +916,7 @@ namespace IPC {
return;
}
if (myPage.mapped) {
semGuard tmpGuard(&mySemaphore);
myPage.mapped[offsetOnPage] = 127;
}
}