mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: fileMonitor: do not allow used watch also in free watches.
See #1328.
This commit is contained in:
@ -450,14 +450,16 @@ Foam::fileMonitor::~fileMonitor()
|
||||
// regIOobject)
|
||||
Foam::label Foam::fileMonitor::addWatch(const fileName& fName)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "fileMonitor : adding watch on file " << fName << endl;
|
||||
}
|
||||
|
||||
label watchFd;
|
||||
|
||||
label sz = freeWatchFds_.size();
|
||||
|
||||
if (sz)
|
||||
if (freeWatchFds_.size())
|
||||
{
|
||||
watchFd = freeWatchFds_[sz-1];
|
||||
freeWatchFds_.setSize(sz-1);
|
||||
watchFd = freeWatchFds_.remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -495,7 +497,10 @@ bool Foam::fileMonitor::removeWatch(const label watchFd)
|
||||
<< watchFile_[watchFd] << endl;
|
||||
}
|
||||
|
||||
if (!freeWatchFds_.found(watchFd))
|
||||
{
|
||||
freeWatchFds_.append(watchFd);
|
||||
}
|
||||
return watcher_->removeWatch(watchFd);
|
||||
}
|
||||
|
||||
|
||||
@ -446,14 +446,16 @@ Foam::fileMonitor::~fileMonitor()
|
||||
// regIOobject)
|
||||
Foam::label Foam::fileMonitor::addWatch(const fileName& fName)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "fileMonitor : adding watch on file " << fName << endl;
|
||||
}
|
||||
|
||||
label watchFd;
|
||||
|
||||
label sz = freeWatchFds_.size();
|
||||
|
||||
if (sz)
|
||||
if (freeWatchFds_.size())
|
||||
{
|
||||
watchFd = freeWatchFds_[sz-1];
|
||||
freeWatchFds_.setSize(sz-1);
|
||||
watchFd = freeWatchFds_.remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -491,7 +493,10 @@ bool Foam::fileMonitor::removeWatch(const label watchFd)
|
||||
<< watchFile_[watchFd] << endl;
|
||||
}
|
||||
|
||||
if (!freeWatchFds_.found(watchFd))
|
||||
{
|
||||
freeWatchFds_.append(watchFd);
|
||||
}
|
||||
return watcher_->removeWatch(watchFd);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user