| OLD | NEW |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 #ifndef SRC_SHARED_PLATFORM_WINDOWS_H_ | 5 #ifndef SRC_SHARED_PLATFORM_WINDOWS_H_ |
| 6 #define SRC_SHARED_PLATFORM_WINDOWS_H_ | 6 #define SRC_SHARED_PLATFORM_WINDOWS_H_ |
| 7 | 7 |
| 8 #ifndef SRC_SHARED_PLATFORM_H_ | 8 #ifndef SRC_SHARED_PLATFORM_H_ |
| 9 #error Do not include platform_win.h directly; use platform.h instead. | 9 #error Do not include platform_win.h directly; use platform.h instead. |
| 10 #endif | 10 #endif |
| 11 | 11 |
| 12 #if defined(FLETCH_TARGET_OS_WIN) | 12 #if defined(DARTINO_TARGET_OS_WIN) |
| 13 | 13 |
| 14 // Prevent the windows.h header from including winsock.h and others. | 14 // Prevent the windows.h header from including winsock.h and others. |
| 15 #ifndef WIN32_LEAN_AND_MEAN | 15 #ifndef WIN32_LEAN_AND_MEAN |
| 16 #define WIN32_LEAN_AND_MEAN | 16 #define WIN32_LEAN_AND_MEAN |
| 17 #endif | 17 #endif |
| 18 | 18 |
| 19 #if _WIN32_WINNT < _WIN32_WINNT_WIN7 | 19 #if _WIN32_WINNT < _WIN32_WINNT_WIN7 |
| 20 #error "Required version of windows headers is at least Windows 7." | 20 #error "Required version of windows headers is at least Windows 7." |
| 21 #endif | 21 #endif |
| 22 | 22 |
| 23 #include <windows.h> | 23 #include <windows.h> |
| 24 | 24 |
| 25 #include "src/shared/globals.h" | 25 #include "src/shared/globals.h" |
| 26 | 26 |
| 27 #define snprintf _snprintf | 27 #define snprintf _snprintf |
| 28 #define MAXPATHLEN MAX_PATH | 28 #define MAXPATHLEN MAX_PATH |
| 29 | 29 |
| 30 namespace fletch { | 30 namespace dartino { |
| 31 | 31 |
| 32 // Forward declare [Platform::GetMicroseconds]. | 32 // Forward declare [Platform::GetMicroseconds]. |
| 33 namespace Platform { | 33 namespace Platform { |
| 34 uint64 GetMicroseconds(); | 34 uint64 GetMicroseconds(); |
| 35 } // namespace Platform | 35 } // namespace Platform |
| 36 | 36 |
| 37 class MutexImpl { | 37 class MutexImpl { |
| 38 public: | 38 public: |
| 39 MutexImpl() : srwlock_(SRWLOCK_INIT) { } | 39 MutexImpl() : srwlock_(SRWLOCK_INIT) { } |
| 40 ~MutexImpl() { } | 40 ~MutexImpl() { } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 int NotifyAll() { | 100 int NotifyAll() { |
| 101 WakeAllConditionVariable(&cond_); | 101 WakeAllConditionVariable(&cond_); |
| 102 return 0; | 102 return 0; |
| 103 } | 103 } |
| 104 | 104 |
| 105 private: | 105 private: |
| 106 SRWLOCK srwlock_; | 106 SRWLOCK srwlock_; |
| 107 CONDITION_VARIABLE cond_; | 107 CONDITION_VARIABLE cond_; |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 } // namespace fletch | 110 } // namespace dartino |
| 111 | 111 |
| 112 #endif // defined(FLETCH_TARGET_OS_WIN) | 112 #endif // defined(DARTINO_TARGET_OS_WIN) |
| 113 | 113 |
| 114 #endif // SRC_SHARED_PLATFORM_WINDOWS_H_ | 114 #endif // SRC_SHARED_PLATFORM_WINDOWS_H_ |
| OLD | NEW |