move usb reset to the main thread to solve large skip on ScreenEnding

This commit is contained in:
Chris Danford
2004-06-06 23:48:22 +00:00
parent c1a0128902
commit 25319403a1
6 changed files with 7 additions and 19 deletions
@@ -25,7 +25,6 @@ MemoryCardDriverThreaded::MemoryCardDriverThreaded() :
m_mutexStorageDevices("StorageDevices") m_mutexStorageDevices("StorageDevices")
{ {
m_bShutdownNextUpdate = false; m_bShutdownNextUpdate = false;
m_bResetNextUpdate = false;
m_bStorageDevicesChanged = false; m_bStorageDevicesChanged = false;
} }
@@ -64,11 +63,6 @@ void MemoryCardDriverThreaded::MountThreadMain()
while( !m_bShutdownNextUpdate ) while( !m_bShutdownNextUpdate )
{ {
LockMut( m_mutexPause ); // wait until we're unpaused LockMut( m_mutexPause ); // wait until we're unpaused
if( m_bResetNextUpdate )
{
this->MountThreadReset();
m_bResetNextUpdate = false;
}
this->MountThreadDoOneUpdate(); this->MountThreadDoOneUpdate();
} }
} }
@@ -112,11 +106,6 @@ bool MemoryCardDriverThreaded::MountAndTestWrite( UsbStorageDevice* pDevice, CSt
return true; return true;
} }
void MemoryCardDriverThreaded::ResetUsbStorage()
{
m_bResetNextUpdate = true;
}
/* /*
* (c) 2003-2004 Chris Danford * (c) 2003-2004 Chris Danford
* All rights reserved. * All rights reserved.
@@ -25,7 +25,6 @@ public:
virtual bool StorageDevicesChanged(); virtual bool StorageDevicesChanged();
virtual void GetStorageDevices( vector<UsbStorageDevice>& vStorageDevicesOut ); virtual void GetStorageDevices( vector<UsbStorageDevice>& vStorageDevicesOut );
virtual bool MountAndTestWrite( UsbStorageDevice* pDevice, CString sMountPoint ); virtual bool MountAndTestWrite( UsbStorageDevice* pDevice, CString sMountPoint );
virtual void ResetUsbStorage();
virtual void PauseMountingThread(); virtual void PauseMountingThread();
virtual void UnPauseMountingThread(); virtual void UnPauseMountingThread();
@@ -35,7 +34,6 @@ private:
RageThread m_threadMemoryCardMount; RageThread m_threadMemoryCardMount;
bool m_bShutdownNextUpdate; bool m_bShutdownNextUpdate;
bool m_bResetNextUpdate;
// Aquire this before detecting devices or reading/writing devices. // Aquire this before detecting devices or reading/writing devices.
// Calling Pause() and Unpause will lock/unlock this so that the mounting thread // Calling Pause() and Unpause will lock/unlock this so that the mounting thread
@@ -44,7 +42,6 @@ private:
protected: protected:
void StartThread(); // call this in the derived constructor to start the mounting thread void StartThread(); // call this in the derived constructor to start the mounting thread
virtual void MountThreadReset() = 0;
virtual void MountThreadDoOneUpdate() = 0; // this will get called as fast as possible virtual void MountThreadDoOneUpdate() = 0; // this will get called as fast as possible
virtual void Mount( UsbStorageDevice* pDevice, CString sMountPoint ) = 0; virtual void Mount( UsbStorageDevice* pDevice, CString sMountPoint ) = 0;
@@ -135,7 +135,7 @@ MemoryCardDriverThreaded_Linux::MemoryCardDriverThreaded_Linux()
this->StartThread(); this->StartThread();
} }
void MemoryCardDriverThreaded_Linux::MountThreadReset() void MemoryCardDriverThreaded_Linux::ResetUsbStorage()
{ {
// //
// if usb-storage gets in a bad state, resetting usb-storage will sometimes fix it. // if usb-storage gets in a bad state, resetting usb-storage will sometimes fix it.
@@ -158,6 +158,8 @@ void MemoryCardDriverThreaded_Linux::MountThreadReset()
m_vDevicesLastSeen.clear(); m_vDevicesLastSeen.clear();
m_bForceRedetect = true; m_bForceRedetect = true;
MountThreadDoOneUpdate();
} }
void MemoryCardDriverThreaded_Linux::MountThreadDoOneUpdate() void MemoryCardDriverThreaded_Linux::MountThreadDoOneUpdate()
@@ -12,7 +12,7 @@ public:
virtual void Flush( UsbStorageDevice* pDevice ); virtual void Flush( UsbStorageDevice* pDevice );
protected: protected:
virtual void Mount( UsbStorageDevice* pDevice, CString sMountPoint ); virtual void Mount( UsbStorageDevice* pDevice, CString sMountPoint );
virtual void MountThreadReset(); virtual void ResetUsbStorage();
virtual void MountThreadDoOneUpdate(); virtual void MountThreadDoOneUpdate();
int m_fd; int m_fd;
@@ -54,7 +54,7 @@ static bool TestWrite( CCStringRef sDrive )
return true; return true;
} }
void MemoryCardDriverThreaded_Windows::MountThreadReset() void MemoryCardDriverThreaded_Windows::ResetUsbStorage()
{ {
m_dwLastLogicalDrives = 0; m_dwLastLogicalDrives = 0;
} }
@@ -13,7 +13,7 @@ public:
virtual void Flush( UsbStorageDevice* pDevice ); virtual void Flush( UsbStorageDevice* pDevice );
protected: protected:
virtual void Mount( UsbStorageDevice* pDevice, CString sMountPoint ); virtual void Mount( UsbStorageDevice* pDevice, CString sMountPoint );
virtual void MountThreadReset(); virtual void ResetUsbStorage();
virtual void MountThreadDoOneUpdate(); virtual void MountThreadDoOneUpdate();
DWORD m_dwLastLogicalDrives; DWORD m_dwLastLogicalDrives;