| | |
| | | class SharedMemory : public mshm_t |
| | | { |
| | | std::string name_; |
| | | Mutex *pmutex_ = 0; |
| | | |
| | | static permissions AllowAll() |
| | | { |
| | |
| | | { |
| | | return construct<T>(name.c_str(), std::nothrow)(std::forward<decltype(params)>(params)...); |
| | | } |
| | | void *Alloc(const size_t size) { return allocate(size, std::nothrow); } |
| | | void *Alloc(const size_t size) |
| | | { |
| | | Guard lock(*pmutex_); |
| | | return allocate(size, std::nothrow); |
| | | } |
| | | void Dealloc(void *p) |
| | | { |
| | | Guard lock(*pmutex_); |
| | | if (p) { deallocate(p); } |
| | | } |
| | | template <class T> |
| | | void Dealloc(offset_ptr<T> ptr) { return Dealloc(ptr.get()); } |
| | | |
| | | template <class T, class... Params> |
| | | T *New(Params &&...params) { return construct<T>(anonymous_instance, std::nothrow)(std::forward<decltype(params)>(params)...); } |
| | | T *New(Params &&...params) |
| | | { |
| | | Guard lock(*pmutex_); |
| | | return construct<T>(anonymous_instance, std::nothrow)(std::forward<decltype(params)>(params)...); |
| | | } |
| | | template <class T> |
| | | void Delete(T *p) |
| | | { |
| | | Guard lock(*pmutex_); |
| | | if (p) { destroy_ptr<T>(p); }; |
| | | } |
| | | template <class T> |