
21 Dec
2009
21 Dec
'09
7:55 a.m.
El 19/12/2009 16:04, blp330 escribió:
Hi,
Do I need to use lock before allocate shared memory?
I have two processes that will allocate string to the same shared memory, do I need to use lock?
No, you don't need a lock when allocating raw memory ("managed_shared_memory.allocated()") or constructing objects ("managed_shared_memory.construct<>"). Once constructed, if two threads use the same objects, you will need to use a lock, just like a std::vector shared by two threads. Best, Ion