Skip to content

Commit

Permalink
Fix shared memory issues with boost>1.47.
Browse files Browse the repository at this point in the history
  • Loading branch information
lotem committed Apr 6, 2015
1 parent 6a6c880 commit 269b854
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions WeaselIPC/WeaselClientImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ bool ClientImpl::GetResponseData(ResponseHandler const& handler)
try
{
windows_shared_memory shm(open_only, WEASEL_IPC_SHARED_MEMORY, read_only);
mapped_region region(shm, read_only, WEASEL_IPC_METADATA_SIZE);
mapped_region region(shm, read_only, WEASEL_IPC_METADATA_SIZE,
WEASEL_IPC_SHARED_MEMORY_SIZE - WEASEL_IPC_METADATA_SIZE);
return handler((LPWSTR)region.get_address(), WEASEL_IPC_BUFFER_LENGTH);
}
catch (interprocess_exception& /*ex*/)
Expand All @@ -213,7 +214,8 @@ bool ClientImpl::_WriteClientInfo()
try
{
windows_shared_memory shm(open_only, WEASEL_IPC_SHARED_MEMORY, read_write);
mapped_region region(shm, read_write, WEASEL_IPC_METADATA_SIZE);
mapped_region region(shm, read_write, WEASEL_IPC_METADATA_SIZE,
WEASEL_IPC_SHARED_MEMORY_SIZE - WEASEL_IPC_METADATA_SIZE);
buffer = (LPWSTR)region.get_address();
if (!buffer)
{
Expand Down
5 changes: 4 additions & 1 deletion WeaselIPCServer/WeaselServerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ extern CAppModule _Module;

SharedMemory::SharedMemory()
{
boost::interprocess::permissions perms;
perms.set_unrestricted();
m_pShm.reset(new windows_shared_memory(create_only,
WEASEL_IPC_SHARED_MEMORY,
read_write,
WEASEL_IPC_SHARED_MEMORY_SIZE));
WEASEL_IPC_SHARED_MEMORY_SIZE,
perms));
m_pRegion.reset(new mapped_region(*m_pShm, read_write));
}

Expand Down

0 comments on commit 269b854

Please sign in to comment.