summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2020-10-12 19:30:49 +0200
committereray orçunus <erayorcunus@gmail.com>2020-10-12 19:30:49 +0200
commitbe6b97b5d8fe253b6cca1c26214bfdc7d55bf42c (patch)
tree700af3c2cc9f6d1a9f7852a00ffa8b19ab5f2e8e /src/core
parentMerge pull request #753 from majesticCoding/miami (diff)
downloadre3-be6b97b5d8fe253b6cca1c26214bfdc7d55bf42c.tar
re3-be6b97b5d8fe253b6cca1c26214bfdc7d55bf42c.tar.gz
re3-be6b97b5d8fe253b6cca1c26214bfdc7d55bf42c.tar.bz2
re3-be6b97b5d8fe253b6cca1c26214bfdc7d55bf42c.tar.lz
re3-be6b97b5d8fe253b6cca1c26214bfdc7d55bf42c.tar.xz
re3-be6b97b5d8fe253b6cca1c26214bfdc7d55bf42c.tar.zst
re3-be6b97b5d8fe253b6cca1c26214bfdc7d55bf42c.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/CdStreamPosix.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/core/CdStreamPosix.cpp b/src/core/CdStreamPosix.cpp
index a6ab62bc..fdc63a05 100644
--- a/src/core/CdStreamPosix.cpp
+++ b/src/core/CdStreamPosix.cpp
@@ -240,9 +240,8 @@ CdStreamRead(int32 channel, void *buffer, uint32 offset, uint32 size)
CdReadInfo *pChannel = &gpReadInfo[channel];
ASSERT( pChannel != nil );
-
if ( pChannel->nSectorsToRead != 0 || pChannel->bReading ) {
- if (pChannel->nSectorOffset == _GET_OFFSET(offset) && pChannel->nSectorsToRead >= size)
+ if (pChannel->hFile == hImage - 1 && pChannel->nSectorOffset == _GET_OFFSET(offset) && pChannel->nSectorsToRead >= size)
return STREAM_SUCCESS;
flushStream[channel] = 1;
@@ -293,7 +292,6 @@ CdStreamGetStatus(int32 channel)
if ( pChannel->nStatus != STREAM_NONE )
{
int32 status = pChannel->nStatus;
-
pChannel->nStatus = STREAM_NONE;
return status;
@@ -322,15 +320,16 @@ CdStreamSync(int32 channel)
pthread_kill(pChannel->pChannelThread, SIGUSR1);
if (pChannel->bReading) {
pChannel->bLocked = true;
- sem_wait(pChannel->pDoneSemaphore);
+ while (pChannel->bLocked)
+ sem_wait(pChannel->pDoneSemaphore);
}
#else
pChannel->nSectorsToRead = 0;
if (pChannel->bReading) {
pChannel->bLocked = true;
pthread_kill(_gCdStreamThread, SIGUSR1);
- sem_wait(pChannel->pDoneSemaphore);
-
+ while (pChannel->bLocked)
+ sem_wait(pChannel->pDoneSemaphore);
}
#endif
pChannel->bReading = false;
@@ -341,8 +340,8 @@ CdStreamSync(int32 channel)
if ( pChannel->nSectorsToRead != 0 )
{
pChannel->bLocked = true;
-
- sem_wait(pChannel->pDoneSemaphore);
+ while (pChannel->bLocked)
+ sem_wait(pChannel->pDoneSemaphore);
}
pChannel->bReading = false;
@@ -443,9 +442,9 @@ void *CdStreamThread(void *param)
#endif
pChannel->nSectorsToRead = 0;
-
if ( pChannel->bLocked )
{
+ pChannel->bLocked = 0;
sem_post(pChannel->pDoneSemaphore);
}
pChannel->bReading = false;