Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

MemoryCardDriverThreaded.h

Go to the documentation of this file.
00001 #ifndef MemoryCardDriverThreaded_H 00002 #define MemoryCardDriverThreaded_H 1 00003 00004 #include "MemoryCardDriver.h" 00005 #include "RageThreads.h" 00006 00007 class MemoryCardDriverThreaded : public MemoryCardDriver 00008 { 00009 public: 00010 MemoryCardDriverThreaded(); 00011 ~MemoryCardDriverThreaded(); 00012 00013 virtual bool StorageDevicesChanged(); 00014 virtual void GetStorageDevices( vector<UsbStorageDevice>& vStorageDevicesOut ); 00015 virtual bool MountAndTestWrite( UsbStorageDevice* pDevice, CString sMountPoint ); 00016 virtual void SetMountThreadState( MountThreadState mts ); 00017 00018 private: 00019 static int MountThread_Start( void *p ); 00020 void MountThreadMain(); 00021 00022 RageThread m_threadMemoryCardMount; 00023 bool m_bShutdownNextUpdate; 00024 00025 // Aquire this before detecting devices or reading/writing devices. 00026 // Calling Pause() and Unpause will lock/unlock this so that the mounting thread 00027 // will temporarily halt. 00028 RageMutex m_mutexPause; 00029 00030 MountThreadState m_MountThreadState; 00031 00032 protected: 00033 void StartThread(); // call this in the derived constructor to start the mounting thread 00034 void StopThread(); // call this in the derived desstructor to stop the mounting thread 00035 virtual void MountThreadDoOneUpdate() = 0; // this will get called as fast as possible 00036 virtual bool MountThreadWaitForUpdate(); 00037 virtual void Mount( UsbStorageDevice* pDevice, CString sMountPoint ) = 0; 00038 bool ShouldDoOsMount() { return m_MountThreadState==detect_and_mount; } 00039 00040 vector<UsbStorageDevice> m_vStorageDevices; 00041 bool m_bStorageDevicesChanged; 00042 RageMutex m_mutexStorageDevices; // protects the above two 00043 00044 // placed here for use by derivitives to eliminate duplicate code 00045 void UnmountMountPoint( const CString &sMountPoint ); 00046 }; 00047 00048 #endif 00049 00050 /* 00051 * (c) 2003-2004 Chris Danford 00052 * All rights reserved. 00053 * 00054 * Permission is hereby granted, free of charge, to any person obtaining a 00055 * copy of this software and associated documentation files (the 00056 * "Software"), to deal in the Software without restriction, including 00057 * without limitation the rights to use, copy, modify, merge, publish, 00058 * distribute, and/or sell copies of the Software, and to permit persons to 00059 * whom the Software is furnished to do so, provided that the above 00060 * copyright notice(s) and this permission notice appear in all copies of 00061 * the Software and that both the above copyright notice(s) and this 00062 * permission notice appear in supporting documentation. 00063 * 00064 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00065 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00066 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 00067 * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS 00068 * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT 00069 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 00070 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 00071 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00072 * PERFORMANCE OF THIS SOFTWARE. 00073 */

Generated on Thu Jan 27 20:57:24 2005 for StepMania by doxygen 1.3.7