bilelmoussaoui / oo7

James Bond went on a new mission as a Secret Service provider
https://bilelmoussaoui.github.io/oo7/oo7/
MIT License
57 stars 11 forks source link

portal: Fix concurrent calls to Keyring::write #55

Closed zecakeh closed 7 months ago

zecakeh commented 7 months ago

Since mtime was inside a RwLock, it would be possible to write in the same file at the same time from concurrent threads, but only the first task would succeed the mtime verification.

This makes sure only one thread at a time can write in the file by using a Mutex.

Fixes #52.

A6GibKm commented 7 months ago

Does the test fail before your change?

zecakeh commented 7 months ago

Yes, it fails before the change.