Boost logo

Boost :

Subject: [boost] windows_shared_memory - does memory block exists?
From: piotr.ns (piotr.ns2012_at_[hidden])
Date: 2013-07-21 15:47:59


Why native windows shared memory does not include any means to check
for existance of memory block without throwing exceptions?

A small function would be enough:

// boost::interprocess::windows_shared_memory
static bool exists(const std::string &a_path)
  using namespace boost::interprocess;

  try {
     unsigned long file_map_access = winapi::page_readonly;
     unsigned long map_access = winapi::file_map_read;

     void *test_handle = winapi::open_file_mapping(map_access, a_path.c_str());

     bool res = (test_handle != NULL);


     return res;
  catch(...) {
    return false;

Without this I have to use Boost internals (winapi::*) in my

Would somebody consider including this code or something similar?


Boost list run by bdawes at, gregod at, cpdaniel at, john at