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:41:13 +0200
commit3772be32bfeaee65de4ca1464786caa50ed30861 (patch)
tree556cd4f4471b1fea8673fb1d97ea0a7de58e67b2 /src/core
parentSome unicode funcs belong to Font.cpp + small fix (diff)
downloadre3-3772be32bfeaee65de4ca1464786caa50ed30861.tar
re3-3772be32bfeaee65de4ca1464786caa50ed30861.tar.gz
re3-3772be32bfeaee65de4ca1464786caa50ed30861.tar.bz2
re3-3772be32bfeaee65de4ca1464786caa50ed30861.tar.lz
re3-3772be32bfeaee65de4ca1464786caa50ed30861.tar.xz
re3-3772be32bfeaee65de4ca1464786caa50ed30861.tar.zst
re3-3772be32bfeaee65de4ca1464786caa50ed30861.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;