Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
7e0f1e2a
Commit
7e0f1e2a
authored
Oct 21, 2010
by
mattijs
Browse files
ENH: allocate fileMonitor only if wanted
parent
0ad7b2cd
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/OSspecific/POSIX/fileMonitor.C
View file @
7e0f1e2a
...
...
@@ -159,15 +159,21 @@ namespace Foam
{
if
(
inotifyFd_
<
0
)
{
WarningIn
(
"fileMonitorWatcher(const label)"
)
<<
"Failed allocating an inotify descriptor : "
<<
string
(
strerror
(
errno
))
<<
endl
<<
" Please increase the number of allowable "
<<
"inotify instances"
<<
endl
<<
" (/proc/sys/fs/inotify/max_user_instances on Linux)"
<<
endl
<<
" Continuing without additional file monitoring."
<<
endl
;
static
bool
hasWarned
=
false
;
if
(
!
hasWarned
)
{
hasWarned
=
true
;
WarningIn
(
"fileMonitorWatcher(const label)"
)
<<
"Failed allocating an inotify descriptor : "
<<
string
(
strerror
(
errno
))
<<
endl
<<
" Please increase the number of allowable "
<<
"inotify instances"
<<
endl
<<
" (/proc/sys/fs/inotify/max_user_instances"
<<
" on Linux)"
<<
endl
<<
" or switch off runTimeModifiable."
<<
endl
<<
" Continuing without additional file monitoring."
<<
endl
;
}
}
}
...
...
src/OpenFOAM/db/Time/Time.C
View file @
7e0f1e2a
...
...
@@ -250,6 +250,7 @@ Foam::Time::Time
// Time objects not registered so do like objectRegistry::checkIn ourselves.
if
(
runTimeModifiable_
)
{
monitorPtr_
.
reset
(
new
fileMonitor
());
controlDict_
.
watchIndex
()
=
addWatch
(
controlDict_
.
filePath
());
}
}
...
...
@@ -312,6 +313,8 @@ Foam::Time::Time
// Time objects not registered so do like objectRegistry::checkIn ourselves.
if
(
runTimeModifiable_
)
{
monitorPtr_
.
reset
(
new
fileMonitor
());
// File might not exist yet.
fileName
f
(
controlDict_
.
filePath
());
if
(
f
!=
fileName
::
null
)
...
...
@@ -392,18 +395,18 @@ Foam::Time::~Time()
Foam
::
label
Foam
::
Time
::
addWatch
(
const
fileName
&
fName
)
const
{
return
monitor
_
.
addWatch
(
fName
);
return
monitor
Ptr_
()
.
addWatch
(
fName
);
}
bool
Foam
::
Time
::
removeWatch
(
const
label
watchIndex
)
const
{
return
monitor
_
.
removeWatch
(
watchIndex
);
return
monitor
Ptr_
()
.
removeWatch
(
watchIndex
);
}
const
Foam
::
fileName
&
Foam
::
Time
::
getFile
(
const
label
watchIndex
)
const
{
return
monitor
_
.
getFile
(
watchIndex
);
return
monitor
Ptr_
()
.
getFile
(
watchIndex
);
}
...
...
@@ -412,13 +415,13 @@ Foam::fileMonitor::fileState Foam::Time::getState
const
label
watchFd
)
const
{
return
monitor
_
.
getState
(
watchFd
);
return
monitor
Ptr_
()
.
getState
(
watchFd
);
}
void
Foam
::
Time
::
setUnmodified
(
const
label
watchFd
)
const
{
monitor
_
.
setUnmodified
(
watchFd
);
monitor
Ptr_
()
.
setUnmodified
(
watchFd
);
}
...
...
src/OpenFOAM/db/Time/Time.H
View file @
7e0f1e2a
...
...
@@ -73,7 +73,7 @@ class Time
// Private data
//- file-change monitor for all registered files
mutable
fileMonitor
monitor_
;
mutable
autoPtr
<
fileMonitor
>
monitor
Ptr
_
;
//- The controlDict
IOdictionary
controlDict_
;
...
...
src/OpenFOAM/db/Time/TimeIO.C
View file @
7e0f1e2a
...
...
@@ -211,10 +211,7 @@ void Foam::Time::readModifiedObjects()
// valid filePath).
// Note: requires same ordering in objectRegistries on different
// processors!
monitor_
.
updateStates
(
Pstream
::
parRun
());
//Pout<< "Time : runTimeModifiable_ and watchIndex:"
// << controlDict_.watchIndex() << endl;
monitorPtr_
().
updateStates
(
Pstream
::
parRun
());
// Time handling is special since controlDict_ is the one dictionary
// that is not registered to any database.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment