mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-08 12:35:48 +00:00
OpenGLDevice: Fix inverted cache file lock
This commit is contained in:
parent
1e839224e8
commit
0bb83f6fd7
@ -2818,7 +2818,7 @@ static bool SetLock(int fd, bool lock, bool block, Error* error)
|
|||||||
bool res;
|
bool res;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
res = (lockf(fd, lock ? (block ? F_TLOCK : F_LOCK) : F_ULOCK, 0) == 0);
|
res = (lockf(fd, lock ? (block ? F_LOCK : F_TLOCK) : F_ULOCK, 0) == 0);
|
||||||
if (!res && errno == EINTR)
|
if (!res && errno == EINTR)
|
||||||
continue;
|
continue;
|
||||||
else
|
else
|
||||||
|
@ -767,7 +767,7 @@ bool OpenGLDevice::OpenPipelineCache(const std::string& path, Error* error)
|
|||||||
|
|
||||||
#ifdef HAS_POSIX_FILE_LOCK
|
#ifdef HAS_POSIX_FILE_LOCK
|
||||||
// Unix doesn't prevent concurrent write access, need to explicitly lock it.
|
// Unix doesn't prevent concurrent write access, need to explicitly lock it.
|
||||||
FileSystem::POSIXLock fp_lock(fp.get(), true, error);
|
FileSystem::POSIXLock fp_lock(fp.get(), false, error);
|
||||||
if (!fp_lock.IsLocked())
|
if (!fp_lock.IsLocked())
|
||||||
{
|
{
|
||||||
Error::AddPrefix(error, "Failed to lock cache file: ");
|
Error::AddPrefix(error, "Failed to lock cache file: ");
|
||||||
@ -865,7 +865,7 @@ bool OpenGLDevice::CreatePipelineCache(const std::string& path, Error* error)
|
|||||||
if (!m_pipeline_disk_cache_file || !FileSystem::FSeek64(m_pipeline_disk_cache_file, 0, SEEK_SET, error))
|
if (!m_pipeline_disk_cache_file || !FileSystem::FSeek64(m_pipeline_disk_cache_file, 0, SEEK_SET, error))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_pipeline_disk_cache_file_lock = FileSystem::POSIXLock(m_pipeline_disk_cache_file, true, error);
|
m_pipeline_disk_cache_file_lock = FileSystem::POSIXLock(m_pipeline_disk_cache_file, false, error);
|
||||||
if (!m_pipeline_disk_cache_file_lock.IsLocked())
|
if (!m_pipeline_disk_cache_file_lock.IsLocked())
|
||||||
{
|
{
|
||||||
Error::AddPrefix(error, "Failed to lock cache file: ");
|
Error::AddPrefix(error, "Failed to lock cache file: ");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user