00001 00002 00003 00004 00005 00006 00007 00008 00009 // No longer used as I no longer support IO Completion ports 00010 /* 00011 #ifdef __USE_IO_COMPLETION_PORTS 00012 00013 #ifndef __ASYNCHRONOUS_FILE_IO_H 00014 #define __ASYNCHRONOUS_FILE_IO_H 00015 00016 #ifdef _XBOX 00017 #elif defined(_WIN32) 00018 // IP_DONTFRAGMENT is different between winsock 1 and winsock 2. Therefore, Winsock2.h must be linked againt Ws2_32.lib 00019 // winsock.h must be linked against WSock32.lib. If these two are mixed up the flag won't work correctly 00020 //#include <winsock2.h> 00021 //#include "WindowsIncludes.h" 00022 #endif 00023 #include "SimpleMutex.h" 00024 00025 struct ExtendedOverlappedStruct; 00026 00028 class AsynchronousFileIO 00029 { 00030 00031 public: 00032 00034 AsynchronousFileIO(); 00035 00036 // Destructor 00037 ~AsynchronousFileIO(); 00038 00039 00043 bool AssociateSocketWithCompletionPort( SOCKET socket, DWORD dwCompletionKey );if 00044 00046 static inline AsynchronousFileIO* Instance() 00047 { 00048 return & I; 00049 } 00050 00052 void IncreaseUserCount( void ); 00053 00055 void DecreaseUserCount( void ); 00056 00058 void Shutdown( void ); 00059 00061 int GetUserCount( void ); 00062 00063 unsigned threadCount; 00064 bool killThreads; 00065 00066 private: 00067 HANDLE completionPort; 00068 SimpleMutex userCountMutex; 00069 SYSTEM_INFO systemInfo; 00070 int userCount; 00071 00072 static AsynchronousFileIO I; 00073 }; 00074 00075 unsigned __stdcall ThreadPoolFunc( LPVOID arguments ); 00076 00077 void WriteAsynch( HANDLE handle, ExtendedOverlappedStruct *extended ); 00078 00079 BOOL ReadAsynch( HANDLE handle, ExtendedOverlappedStruct *extended ); 00080 00081 #endif 00082 */