Sory but did i miss something? i mean im new to askexpert, and unfornetly
cant understand where to look for thread A and B codes? is that attached
to your reply? or to which page im supposed to look for your replies?
i did not receive anything but the following reply,
once again thank you for your interest,
Thread A opens and creates the file myfile.txt, puts data into it and
closes the file. After this thread A opens/creates the file myfile.flag
and closes it (produces a zero length file).
Thread B waits (hope you use some sleep instructions in the code to save
CPU) until it can see myfile.flag. When this appears it moves the file
myfile.txt to wherever it wants. When the file myfile.flag starts to be
old (e.g. 30 seconds old) thread B deletes the myfile.flag.
You have got all the answer. That was my answer: a technique that can be
used to wait for a file processing been finished. I did not give you any
sample code. You should use the same functions and code fragments as you
used before, but should generate and wait for an extra file called
myfile.flag for any myfile.txt which contains nothing, but you can wait
for it to appear in the directory.
[ back to toc ]