dxd - dynax driver framework 3.0.2
cross platform open source driver development framework
Loading...
Searching...
No Matches
dx::shared::memory< buffer_t > Class Template Reference

macOS user space shared memory More...

#include <dx_shared_memory.h>

Inheritance diagram for dx::shared::memory< buffer_t >:
Collaboration diagram for dx::shared::memory< buffer_t >:

Classes

struct  header
 what every shared segment carries ahead of its payload: the version the host wrote it with and its size, so an attaching process refuses a segment of another build More...

Public Member Functions

 catch(...)
 catch(...)
void free() noexcept
void free() noexcept
memory& initialize(const std::string& name, uint32_t version, size_t size= 0)
memory& initialize(const std::string& name, uint32_t version, size_t size= 0)
memory& initialize(size_t size, bool leftovers)
memory& initialize(size_t size= 0)
memory& initialize(size_t size= 0)
reference& initialize(const std::string& name)
 memory()= default
 memory()= default
 memory(const std::string& name, uint32_t version, size_t size= 0) noexcept
 memory(const std::string& name, uint32_t version, size_t size= sizeof(buffer_t) - sizeof(header)) noexcept
 operator bool() const noexcept
 true if this shared memory is currently in use by some process - a cheap, non-destructive existence probe (shm_open without O_CREAT, then immediately close) that neither maps nor creates anything itself.
 operator bool() const noexcept
 true if this shared memory is currently in use by some process - a cheap, non-destructive existence probe (open, then immediately close, the underlying file mapping object by name) that neither maps nor creates anything itself. Crash-safe without any separate refcounting primitive: the OS keeps the file mapping kernel object alive exactly as long as any process holds a real (mapped) handle to it, closing it automatically on that process' crash/exit.
 operator buffer_t&()
 operator buffer_t&()
 operator buffer_t*()
 operator buffer_t*()
 operator const os_event() const noexcept
 operator const os_event() const noexcept
 operator os_event() noexcept
 operator os_event() noexcept
 operator struct ::stat()
buffer_t& operator *()
buffer_t& operator *()
buffer_t* operator ->()
buffer_t* operator ->()
 operator ::HANDLE() const noexcept
 operator ::HANDLE() const noexcept
memory& operator =(const buffer_t& buffer)
memory& operator =(const buffer_t& buffer)
template<typename last_t>
void release(last_t&& last) noexcept
 releases this hold - last run where it was the last one
template<typename last_t>
void release(last_t&& last) noexcept
 releases this hold - last run where it was the last one
size_t size() const
 ~memory()
 ~memory() noexcept

Static Public Member Functions

static bool exists(const std::string& name) noexcept
 the same probe on a name alone, for a side that must attach to another's segment rather than create one
static bool exists(const std::string& name) noexcept
 the same probe on a name alone, for a side that must attach to another's segment rather than create one
static std::string path(const std::string& name)
 the name a segment carries in the system: the uid, hashed where it exceeds what a shared memory name takes
static std::string path(const std::string& name)
 the name a file mapping carries in the system: the uid, made a valid name and global

Protected Attributes

::HANDLE process
::HANDLE process

Detailed Description

template<typename buffer_t>
class dx::shared::memory< buffer_t >

macOS user space shared memory

windows user space shared memory

The constructor only stores the canonical name/version/size - the actual mapping only happens once the buffer is first genuinely requested (through one of the pointer/reference accessors), not eagerly at construction: whichever side (server or client) first actually wants the buffer becomes the creator, rather than whichever side's device object simply happens to construct first.

The constructor only stores the requested name/version/size - the actual mapping only happens once the buffer is first genuinely requested (through one of the pointer/reference accessors), not eagerly at construction: whichever side (server or client) first actually wants the buffer becomes the creator, rather than whichever side's device object simply happens to construct first.

Constructor & Destructor Documentation

◆ memory() [1/4]

template<typename buffer_t>
dx::shared::memory<buffer_t>::memory()
default

◆ memory() [2/4]

template<typename buffer_t>
dx::shared::memory<buffer_t>::memory(const std::string& name, uint32_t version, size_t size= 0)
inlinenoexcept

◆ ~memory() [1/2]

template<typename buffer_t>
dx::shared::memory<buffer_t>::~memory()
inline

◆ memory() [3/4]

template<typename buffer_t>
dx::shared::memory<buffer_t>::memory()
default

◆ memory() [4/4]

template<typename buffer_t>
dx::shared::memory<buffer_t>::memory(const std::string& name, uint32_t version, size_t size= sizeof(buffer_t)- sizeof(header))
inlinenoexcept

◆ ~memory() [2/2]

template<typename buffer_t>
dx::shared::memory<buffer_t>::~memory()
inlinenoexcept

Member Function Documentation

◆ catch() [1/2]

template<typename buffer_t>
dx::shared::memory<buffer_t>::catch(...)
inline

◆ catch() [2/2]

template<typename buffer_t>
dx::shared::memory<buffer_t>::catch(...)
inline

◆ exists() [1/2]

template<typename buffer_t>
bool dx::shared::memory<buffer_t>::exists(const std::string& name)
inlinestaticnoexcept

the same probe on a name alone, for a side that must attach to another's segment rather than create one

◆ exists() [2/2]

template<typename buffer_t>
bool dx::shared::memory<buffer_t>::exists(const std::string& name)
inlinestaticnoexcept

the same probe on a name alone, for a side that must attach to another's segment rather than create one

◆ free() [1/2]

◆ free() [2/2]

template<typename buffer_t>
void dx::shared::memory<buffer_t>::free()
inlinevirtualnoexcept

◆ initialize() [1/6]

template<typename buffer_t>
memory& dx::shared::memory<buffer_t>::initialize(const std::string& name, uint32_t version, size_t size= 0)
inline
Here is the caller graph for this function:

◆ initialize() [2/6]

template<typename buffer_t>
memory& dx::shared::memory<buffer_t>::initialize(const std::string& name, uint32_t version, size_t size= 0)
inline

◆ initialize() [3/6]

template<typename buffer_t>
memory& dx::shared::memory<buffer_t>::initialize(size_t size, bool leftovers)
inline

a segment of another build, and this caller is the side that sizes it: the leftover of a host that never unlinked it is dropped, so this host creates its own. A hosted side, which states no size, has nothing to create and says so below

Todo
shared::memory: buffer initialization @ version mismatch!

◆ initialize() [4/6]

template<typename buffer_t>
memory& dx::shared::memory<buffer_t>::initialize(size_t size= 0)
inline
Here is the caller graph for this function:

◆ initialize() [5/6]

template<typename buffer_t>
memory& dx::shared::memory<buffer_t>::initialize(size_t size= 0)
inline

◆ initialize() [6/6]

reference& dx::shared::reference::initialize(const std::string& name)
inlineinherited
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator bool() [1/2]

template<typename buffer_t>
dx::shared::memory<buffer_t>::operator bool() const
inlinenoexcept

true if this shared memory is currently in use by some process - a cheap, non-destructive existence probe (shm_open without O_CREAT, then immediately close) that neither maps nor creates anything itself.

◆ operator bool() [2/2]

template<typename buffer_t>
dx::shared::memory<buffer_t>::operator bool() const
inlinenoexcept

true if this shared memory is currently in use by some process - a cheap, non-destructive existence probe (open, then immediately close, the underlying file mapping object by name) that neither maps nor creates anything itself. Crash-safe without any separate refcounting primitive: the OS keeps the file mapping kernel object alive exactly as long as any process holds a real (mapped) handle to it, closing it automatically on that process' crash/exit.

◆ operator buffer_t &() [1/2]

template<typename buffer_t>
dx::shared::memory<buffer_t>::operator buffer_t&()
inline

◆ operator buffer_t &() [2/2]

template<typename buffer_t>
dx::shared::memory<buffer_t>::operator buffer_t&()
inline

◆ operator buffer_t *() [1/2]

template<typename buffer_t>
dx::shared::memory<buffer_t>::operator buffer_t*()
inlineexplicit

◆ operator buffer_t *() [2/2]

template<typename buffer_t>
dx::shared::memory<buffer_t>::operator buffer_t*()
inlineexplicit

◆ operator const os_event() [1/2]

dx::resource<invalid_t>::operator const os_event() const
inlinenoexceptinherited

◆ operator const os_event() [2/2]

dx::resource<invalid_t>::operator const os_event() const
inlinenoexceptinherited

◆ operator os_event() [1/2]

dx::resource<invalid_t>::operator os_event()
inlinenoexceptinherited

◆ operator os_event() [2/2]

dx::resource<invalid_t>::operator os_event()
inlinenoexceptinherited

◆ operator struct ::stat()

template<typename buffer_t>
dx::shared::memory<buffer_t>::operator struct ::stat()
inline

◆ operator *() [1/2]

template<typename buffer_t>
buffer_t& dx::shared::memory<buffer_t>::operator *()
inline

◆ operator *() [2/2]

template<typename buffer_t>
buffer_t& dx::shared::memory<buffer_t>::operator *()
inline

◆ operator ->() [1/2]

template<typename buffer_t>
buffer_t* dx::shared::memory<buffer_t>::operator ->()
inline

◆ operator ->() [2/2]

template<typename buffer_t>
buffer_t* dx::shared::memory<buffer_t>::operator ->()
inline

◆ operator ::HANDLE() [1/2]

dx::resource<invalid_t>::operator ::HANDLE() const
inlinenoexceptinherited
Here is the caller graph for this function:

◆ operator ::HANDLE() [2/2]

dx::resource<invalid_t>::operator ::HANDLE() const
inlinenoexceptinherited
Here is the caller graph for this function:

◆ operator =() [1/2]

template<typename buffer_t>
memory& dx::shared::memory<buffer_t>::operator =(const buffer_t& buffer)
inline

◆ operator =() [2/2]

template<typename buffer_t>
memory& dx::shared::memory<buffer_t>::operator =(const buffer_t& buffer)
inline

◆ path() [1/2]

template<typename buffer_t>
std::string dx::shared::memory<buffer_t>::path(const std::string& name)
inlinestatic

the name a segment carries in the system: the uid, hashed where it exceeds what a shared memory name takes

◆ path() [2/2]

template<typename buffer_t>
std::string dx::shared::memory<buffer_t>::path(const std::string& name)
inlinestatic

the name a file mapping carries in the system: the uid, made a valid name and global

◆ release() [1/2]

template<typename last_t>
void dx::shared::reference::release(last_t&& last)
inlinenoexceptinherited

releases this hold - last run where it was the last one

Here is the call graph for this function:
Here is the caller graph for this function:

◆ release() [2/2]

template<typename last_t>
void dx::shared::reference::release(last_t&& last)
inlinenoexceptinherited

releases this hold - last run where it was the last one

Here is the call graph for this function:

◆ size()

template<typename buffer_t>
size_t dx::shared::memory<buffer_t>::size() const
inline

Member Data Documentation

◆ process [1/2]

::HANDLE dx::resource<invalid_t>::process
protectedinherited

◆ process [2/2]

::HANDLE dx::resource<invalid_t>::process
protectedinherited

The documentation for this class was generated from the following files: