const string pretty_pv(const Position& pos, int time, int depth,
Value score, ValueType type, Move pv[]) {
- const uint64_t K = 1000;
- const uint64_t M = 1000000;
+ const int64_t K = 1000;
+ const int64_t M = 1000000;
std::stringstream s;
void extract_pv_from_tt(const Position& pos, Move bestMove, Move pv[]);
#if !defined(_MSC_VER)
- void *init_thread(void *threadID);
+ void* init_thread(void* threadID);
#else
DWORD WINAPI init_thread(LPVOID threadID);
#endif
#if !defined(_MSC_VER)
- void* init_thread(void *threadID) {
+ void* init_thread(void* threadID) {
ThreadsMgr.idle_loop(*(int*)threadID, NULL);
return NULL;
void ThreadsManager::init_threads() {
- volatile int i;
+ int i, arg[MAX_THREADS];
bool ok;
// Initialize global locks
// Launch the helper threads
for (i = 1; i < MAX_THREADS; i++)
{
+ arg[i] = i;
#if !defined(_MSC_VER)
pthread_t pthread[1];
- ok = (pthread_create(pthread, NULL, init_thread, (void*)(&i)) == 0);
+ ok = (pthread_create(pthread, NULL, init_thread, (void*)(&arg[i])) == 0);
pthread_detach(pthread[0]);
#else
- ok = (CreateThread(NULL, 0, init_thread, (LPVOID)(&i), 0, NULL) != NULL);
+ ok = (CreateThread(NULL, 0, init_thread, (LPVOID)(&arg[i]), 0, NULL) != NULL);
#endif
-
if (!ok)
{
cout << "Failed to create thread number " << i << endl;
else if (token == "d")
pos.print();
else if (token == "flip")
- pos.flipped_copy(Position(pos, pos.thread()));
+ {
+ Position p(pos, pos.thread());
+ pos.flipped_copy(p);
+ }
else if (token == "eval")
{
Value evalMargin;