[Boost-users] error in recreation of shared memory using boost:: interprocess

388 views
Skip to first unread message

manish4gupta

unread,
Oct 7, 2009, 2:57:40 AM10/7/09
to boost...@lists.boost.org

Hi,
I am creating shared memory with given name(by given file name with key
value ) and creating the map in the shared region by parsing key-value from
the file. First time it is ok. but when i try to do it again, I am getting
following error.

terminate called after throwing an instance of
'boost::interprocess::interprocess_exception'
what(): File exists
Aborted

What is the cause of this error. Thanks in advance.
--
View this message in context: http://www.nabble.com/error-in-recreation-of-shared-memory-using-boost%3A%3A-interprocess-tp25781436p25781436.html
Sent from the Boost - Users mailing list archive at Nabble.com.

_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Christoph Gysin

unread,
Oct 7, 2009, 7:56:16 PM10/7/09
to boost...@lists.boost.org
> I am creating shared memory with given name(by given file name with key
> value ) and creating the map in the shared region by parsing key-value from
> the file. First time it is ok. but when i try to do it again, I am getting
> following error.
>
> terminate called after throwing an instance of
> 'boost::interprocess::interprocess_exception'
>  what():  File exists
> Aborted

Please read the documentation:
http://www.boost.org/doc/libs/1_40_0/doc/html/boost/interprocess/shared_memory_object.html

...
shared_memory_object(create_only_t, const char * name, mode_t mode);

Creates a shared memory object with name "name" and mode "mode", with
the access mode "mode" If the file previously exists, throws an error.

shared_memory_object(open_or_create_t, const char * name, mode_t mode);

Tries to create a shared memory object with name "name" and mode
"mode", with the access mode "mode". If the file previously exists, it
tries to open it with mode "mode". Otherwise throws an error.
...

Christoph
--
echo mailto: NOSPAM !#$.'<*>'|sed 's. ..'|tr "<*> !#:2" org@fr33z3

Reply all
Reply to author
Forward
0 new messages