diff --git a/include/boost/interprocess/xsi_key.hpp b/include/boost/interprocess/xsi_key.hpp index 084411ed..2dbfa66f 100644 --- a/include/boost/interprocess/xsi_key.hpp +++ b/include/boost/interprocess/xsi_key.hpp @@ -46,7 +46,8 @@ namespace boost { namespace interprocess { //!A class that wraps XSI (System V) key_t type. -//!This type calculates key_t from path and id using ftok +//!This type calculates key_t from path and id using ftok, +//!sets key to a specified value, //!or sets key to IPC_PRIVATE using the default constructor. class xsi_key { @@ -58,6 +59,11 @@ class xsi_key : m_key(IPC_PRIVATE) {} + //!Creates a new XSI key using a specified value. Constructor is explicit to avoid ambiguity with shmid. + explicit xsi_key(key_t key) + : m_key(key) + {} + //!Creates a new XSI shared memory with a key obtained from a call to ftok (with path //!"path" and id "id"), of size "size" and permissions "perm". //!If the shared memory previously exists, throws an error.