1 /** 2 * @file mega/win32/megawaiter.h 3 * @brief Win32 event/timeout handling 4 * 5 * (c) 2013-2014 by Mega Limited, Auckland, New Zealand 6 * 7 * This file is part of the MEGA SDK - Client Access Engine. 8 * 9 * Applications using the MEGA API must present a valid application key 10 * and comply with the the rules set forth in the Terms of Service. 11 * 12 * The MEGA SDK is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 * 16 * @copyright Simplified (2-clause) BSD License. 17 * 18 * You should have received a copy of the license along with this 19 * program. 20 */ 21 22 #ifndef WAIT_CLASS 23 #define WAIT_CLASS WinWaiter 24 25 typedef ULONGLONG (WINAPI * PGTC)(); 26 27 extern PGTC pGTC; 28 29 namespace mega { 30 class MEGA_API WinWaiter : public Waiter 31 { 32 vector<HANDLE> handles; 33 vector<int> flags; 34 35 size_t index = 0; 36 37 public: 38 PCRITICAL_SECTION pcsHTTP; 39 40 int wait(); 41 42 bool addhandle(HANDLE handle, int); 43 void notify(); 44 45 WinWaiter(); 46 ~WinWaiter(); 47 48 #ifdef MEGA_MEASURE_CODE 49 struct PerformanceStats 50 { 51 uint64_t waitTimedoutNonzero = 0; 52 uint64_t waitTimedoutZero = 0; 53 uint64_t waitIOCompleted = 0; 54 uint64_t waitSignalled= 0; 55 } performanceStats; 56 #endif 57 58 protected: 59 HANDLE externalEvent; 60 }; 61 } // namespace 62 63 #endif 64