Boost logo

Boost Users :

Subject: [Boost-users] Making interprocess::message_queue use Windows_shared_memory instead of shared_memory_object
From: Gaurav Sehgal (gauravsehgal93_at_[hidden])
Date: 2018-10-04 10:52:20


Hi,

I am trying to make boost::interprocess::message_queue to use
windows_shared_memory, instead of shared_memory_object. I have made the
below changes to boost version 1.65.1

1) In ipc\message_queue.hpp, included windows_shared_memory.hpp instead of
shared_memory_object.hpp
2) Changed
typedef ipcdetail::managed_open_or_create_impl<shared_memory_object, 0,
true, false> open_create_impl_t;

to

typedef ipcdetail::managed_open_or_create_impl<windows_shared_memory, 0,
false, false> open_create_impl_t;
3) Changed the below in mq_hdr_t::
typedef ipcdetail::managed_open_or_create_impl<shared_memory_object, 0,
true, false> open_create_impl_t;

to

typedef ipcdetail::managed_open_or_create_impl<windows_shared_memory, 0,
false, false> open_create_impl_t;

4) Changed

inline bool message_queue_t<VoidPointer>::remove(const char *name)
{ return shared_memory_object::remove(name); }

to

inline bool message_queue_t<VoidPointer>::remove(const char *name)
{ return true; }

5)Changed the below in detail\managed_open_or_create_impl.hpp

template<bool dummy>
   static void truncate_device(DeviceAbstraction &dev, offset_t size,
true_)
   { dev.truncate(size); }

to

template<bool dummy>
   static void truncate_device(DeviceAbstraction &dev, offset_t size,
true_)
   { }

After the above changes, no file is getting created and everything seems to
work. Is there something else i should care about?

Regards,
Gaurav.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net