• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 
7 // Windows_system_utils.cpp: Implementation of OS-specific functions for Windows
8 
9 #include <stdarg.h>
10 #include <windows.h>
11 #include <array>
12 #include <vector>
13 
14 namespace angle
15 {
16 
Sleep(unsigned int milliseconds)17 void Sleep(unsigned int milliseconds)
18 {
19     ::Sleep(static_cast<DWORD>(milliseconds));
20 }
21 
WriteDebugMessage(const char * format,...)22 void WriteDebugMessage(const char *format, ...)
23 {
24     va_list args;
25     va_start(args, format);
26     int size = vsnprintf(nullptr, 0, format, args);
27     va_end(args);
28 
29     std::vector<char> buffer(size + 2);
30     va_start(args, format);
31     vsnprintf(buffer.data(), size + 1, format, args);
32     va_end(args);
33 
34     OutputDebugStringA(buffer.data());
35 }
36 
37 }  // namespace angle
38