mirror of https://github.com/BOINC/boinc.git
Flush ProgressFile updates added.
This new feature prevents from losing progress data from an unexpected reboot. svn path=/trunk/boinc/; revision=23642
This commit is contained in:
parent
7932dde4d7
commit
4d74982131
|
@ -737,6 +737,18 @@ void write_progress(time_t secs)
|
|||
{
|
||||
FILE* f = fopen(PROGRESS_FN, "w");
|
||||
fprintf(f,"%ld\n", secs);
|
||||
//Flushing progress file after 5 minutes for not losing work
|
||||
if ((int)boinc_elapsed_time() % (5*60) == 0)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
fprintf(stderr,"INFO: Flushing buffers after 5 minutes!\n");
|
||||
fflush(f);
|
||||
_commit(_fileno(f));
|
||||
#else
|
||||
fprintf(stderr,"INFO: Flushing buffers after 5 minutes!\n");
|
||||
fsync(fileno(f));
|
||||
#endif
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue