Disk write in a "for" loop with RwMutex never happens

Gavin Ray ray.gavin97 at gmail.com
Mon Aug 29 14:22:12 UTC 2022


On Monday, 29 August 2022 at 07:04:49 UTC, bauss wrote:
>> Does anyone know what is happening here? It's really puzzling.
>
> You probably need to flush the output.

That's a good idea. I gave it a shot, and the following doesn't 
seem to change anything unfortunately:

```d
void writePage(PageId pageId, ubyte[PAGE_SIZE] pageData)
{
     synchronized (dbIOMutex.writer)
     {
         dbFile.seek(pageId * PAGE_SIZE);
         dbFile.rawWrite(pageData);
         dbFile.flush();
         dbFile.sync();
     }
}
```


More information about the Digitalmars-d-learn mailing list