Added sharedPage::exists() call
This commit is contained in:
parent
12d18bd7c5
commit
bea8678df9
2 changed files with 14 additions and 0 deletions
|
@ -348,6 +348,18 @@ namespace IPC {
|
|||
close();
|
||||
}
|
||||
|
||||
/// Returns true if the open file still exists.
|
||||
/// Not implemented under Windows.
|
||||
bool sharedPage::exists(){
|
||||
#ifdef SHM_ENABLED
|
||||
struct stat sb;
|
||||
if (fstat(handle, &sb)){return false;}
|
||||
return (sb.st_nlink > 0);
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SHM_ENABLED
|
||||
///\brief Unmaps a shared page if allowed
|
||||
void sharedPage::unmap() {
|
||||
|
|
|
@ -109,6 +109,7 @@ namespace IPC {
|
|||
bool operator < (const sharedFile & rhs) const {
|
||||
return name < rhs.name;
|
||||
}
|
||||
bool exists(){return true;}
|
||||
void close();
|
||||
void unmap();
|
||||
///\brief The fd handle of the opened shared file
|
||||
|
@ -143,6 +144,7 @@ namespace IPC {
|
|||
}
|
||||
void unmap();
|
||||
void close();
|
||||
bool exists();
|
||||
#if defined(__CYGWIN__) || defined(_WIN32)
|
||||
///\brief The handle of the opened shared memory page
|
||||
HANDLE handle;
|
||||
|
|
Loading…
Add table
Reference in a new issue