I could, but there is a coordination hole since the thread writing to the file will be incrementing that value while the sync starts. I went with something more brain dead this time. The task to sync periodically exists solely to get things flushing to disk sooner and in smaller increments. Bounding the total number of bytes is done by syncing directly from the thread writing to the file every 256 megabytes.

I suppose it would be a performance optimization to avoid doing the extra bounding syncs if the periodic task is keeping up.