Changes in lemon/bits/windows.cc [1055:60f4aaedb20f:1341:c199e9976d93] in lemon
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/bits/windows.cc
r1055 r1341 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 2003-201 05 * Copyright (C) 2003-2013 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 22 22 #include<lemon/bits/windows.h> 23 23 24 #ifdef WIN32 24 #if defined(LEMON_WIN32) && defined(__GNUC__) 25 #pragma GCC diagnostic ignored "-Wold-style-cast" 26 #endif 27 28 #ifdef LEMON_WIN32 25 29 #ifndef WIN32_LEAN_AND_MEAN 26 30 #define WIN32_LEAN_AND_MEAN … … 41 45 #include <unistd.h> 42 46 #include <ctime> 43 #ifndef WIN3247 #ifndef LEMON_WIN32 44 48 #include <sys/times.h> 45 49 #endif … … 56 60 double &cutime, double &cstime) 57 61 { 58 #ifdef WIN3262 #ifdef LEMON_WIN32 59 63 static const double ch = 4294967296.0e-7; 60 64 static const double cl = 1.0e-7; … … 95 99 { 96 100 std::ostringstream os; 97 #ifdef WIN32101 #ifdef LEMON_WIN32 98 102 SYSTEMTIME time; 99 103 GetSystemTime(&time); 100 104 char buf1[11], buf2[9], buf3[5]; 101 105 if (GetDateFormat(MY_LOCALE, 0, &time, 102 106 ("ddd MMM dd"), buf1, 11) && 103 107 GetTimeFormat(MY_LOCALE, 0, &time, … … 121 125 int getWinRndSeed() 122 126 { 123 #ifdef WIN32127 #ifdef LEMON_WIN32 124 128 FILETIME time; 125 129 GetSystemTimeAsFileTime(&time); … … 131 135 #endif 132 136 } 137 138 WinLock::WinLock() { 139 #ifdef LEMON_WIN32 140 CRITICAL_SECTION *lock = new CRITICAL_SECTION; 141 InitializeCriticalSection(lock); 142 _repr = lock; 143 #else 144 _repr = 0; //Just to avoid 'unused variable' warning with clang 145 #endif 146 } 147 148 WinLock::~WinLock() { 149 #ifdef LEMON_WIN32 150 CRITICAL_SECTION *lock = static_cast<CRITICAL_SECTION*>(_repr); 151 DeleteCriticalSection(lock); 152 delete lock; 153 #endif 154 } 155 156 void WinLock::lock() { 157 #ifdef LEMON_WIN32 158 CRITICAL_SECTION *lock = static_cast<CRITICAL_SECTION*>(_repr); 159 EnterCriticalSection(lock); 160 #endif 161 } 162 163 void WinLock::unlock() { 164 #ifdef LEMON_WIN32 165 CRITICAL_SECTION *lock = static_cast<CRITICAL_SECTION*>(_repr); 166 LeaveCriticalSection(lock); 167 #endif 168 } 133 169 } 134 170 }
Note: See TracChangeset
for help on using the changeset viewer.