Added sharedFile::exists() call to match version in sharedPage class, fixed sharedPage::exists not being inside SHM_ENABLED block.
This commit is contained in:
parent
9947f3a5ec
commit
ff19c9c625
2 changed files with 10 additions and 2 deletions
|
@ -348,6 +348,8 @@ namespace IPC {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SHM_ENABLED
|
||||||
|
|
||||||
/// Returns true if the open file still exists.
|
/// Returns true if the open file still exists.
|
||||||
/// \TODO Not implemented under Windows.
|
/// \TODO Not implemented under Windows.
|
||||||
bool sharedPage::exists(){
|
bool sharedPage::exists(){
|
||||||
|
@ -364,7 +366,6 @@ namespace IPC {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SHM_ENABLED
|
|
||||||
///\brief Unmaps a shared page if allowed
|
///\brief Unmaps a shared page if allowed
|
||||||
void sharedPage::unmap() {
|
void sharedPage::unmap() {
|
||||||
if (mapped && len) {
|
if (mapped && len) {
|
||||||
|
@ -561,6 +562,13 @@ namespace IPC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns true if the open file still exists.
|
||||||
|
bool sharedFile::exists(){
|
||||||
|
struct stat sb;
|
||||||
|
if (fstat(handle, &sb)){return false;}
|
||||||
|
return (sb.st_nlink > 0);
|
||||||
|
}
|
||||||
|
|
||||||
///\brief Initialize a page, de-initialize before if needed
|
///\brief Initialize a page, de-initialize before if needed
|
||||||
///\param name_ The name of the page to be created
|
///\param name_ The name of the page to be created
|
||||||
///\param len_ The size to make the page
|
///\param len_ The size to make the page
|
||||||
|
|
|
@ -109,9 +109,9 @@ namespace IPC {
|
||||||
bool operator < (const sharedFile & rhs) const {
|
bool operator < (const sharedFile & rhs) const {
|
||||||
return name < rhs.name;
|
return name < rhs.name;
|
||||||
}
|
}
|
||||||
bool exists(){return true;}
|
|
||||||
void close();
|
void close();
|
||||||
void unmap();
|
void unmap();
|
||||||
|
bool exists();
|
||||||
///\brief The fd handle of the opened shared file
|
///\brief The fd handle of the opened shared file
|
||||||
int handle;
|
int handle;
|
||||||
///\brief The name of the opened shared file
|
///\brief The name of the opened shared file
|
||||||
|
|
Loading…
Add table
Reference in a new issue