/*
Stockfish, a UCI chess playing engine derived from Glaurung 2.1
Copyright (c) 2013 Ronald de Man
- Copyright (C) 2016-2018 Marco Costalba, Lucas Braesch
+ Copyright (C) 2016-2019 Marco Costalba, Lucas Braesch
Stockfish is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <list>
#include <sstream>
#include <type_traits>
+#include <mutex>
#include "../bitboard.h"
#include "../movegen.h"
#include "../position.h"
#include "../search.h"
-#include "../thread_win32.h"
#include "../types.h"
#include "../uci.h"
#include <sys/stat.h>
#else
#define WIN32_LEAN_AND_MEAN
-#define NOMINMAX
+#ifndef NOMINMAX
+# define NOMINMAX // Disable macros min() and max()
+#endif
#include <windows.h>
#endif
hasPawns = pos.pieces(PAWN);
hasUniquePieces = false;
- for (Color c = WHITE; c <= BLACK; ++c)
+ for (Color c : { WHITE, BLACK })
for (PieceType pt = PAWN; pt < KING; ++pt)
if (popcount(pos.pieces(c, pt)) == 1)
hasUniquePieces = true;
template<TBType Type>
void* mapped(TBTable<Type>& e, const Position& pos) {
- static Mutex mutex;
+ static std::mutex mutex;
// Use 'acquire' to avoid a thread reading 'ready' == true while
// another is still working. (compiler reordering may cause this).
if (e.ready.load(std::memory_order_acquire))
return e.baseAddress; // Could be nullptr if file does not exist
- std::unique_lock<Mutex> lk(mutex);
+ std::unique_lock<std::mutex> lk(mutex);
if (e.ready.load(std::memory_order_relaxed)) // Recheck under lock
return e.baseAddress;