I have following scenario:
My code invokes external function (some type of print) in the loop.
In each iteration, after variable amount of time (< 2 mins) it saves
the file in the specific directory or it may fail to print and I need to advance to the next loop cycle.
Logically it is like that:
while (1)
{
// waitfor returns true if file is found. If 3 minutes passed and file
// is not found where it is supposed to be, do nothing
if (waitfor (printfile(), 3))
{
// do something with the file
}
}
while (1)
{
// waitfor returns true if file is found. If 3 minutes passed and file
// is not found where it is supposed to be, do nothing
if (waitfor (printfile(), 3))
{
// do something with the file
}
}
To copy to clipboard, switch view to plain text mode
Printfile should monitor the appearance of the file in a certain directory. If not found in 2 mins, proceed to the next loop.
I am perfectly capable of doing something with straight c++ or boost. I am interested in understanding
how it can be implemented using specialized Qt classes, like QFileSystemWatcher, QFuture or others.
In QFileSystemWatcher, for example, I don't see how can I do wait without putting some wait conditions in the slot;
Advise is greatly appreciated.
Thanks.
Bookmarks