X-Git-Url: http://winboard.nl/cgi-bin?p=polyglot.git;a=blobdiff_plain;f=engine.cpp;h=b6c0f4bf1a37f04320720bf9823a0832997b0567;hp=f5c53c673a7f8d8f179d58bd0543591b813d1d3f;hb=07265afaa167049a447b4c5f43e5ef90c7451a49;hpb=8c255c15cc55a2e5254152c8e07a8ab45b22b7af diff --git a/engine.cpp b/engine.cpp index f5c53c6..b6c0f4b 100644 --- a/engine.cpp +++ b/engine.cpp @@ -321,6 +321,19 @@ engine_t Engine[1]; // functions +void set_affinity(engine_t *engine, int affin){ + if(affin==-1) return; + { typedef void (WINAPI *SPAM)(HANDLE, int); + SPAM pSPAM; + + pSPAM = (SPAM) GetProcAddress( + GetModuleHandle(TEXT("kernel32.dll")), + "SetProcessAffinityMask"); + if(NULL != pSPAM) // [HGM] avoid crash on Win95 by first checking if API call exists + pSPAM((engine->io).hProcess,affin); + } +} + DWORD GetWin32Priority(int nice) { /* @@ -338,21 +351,11 @@ IDLE_PRIORITY_CLASS 0x00000040 return 0x00000040; } - - -void set_affinity(engine_t *engine, int affin){ - if(affin==-1) return; - SetProcessAffinityMask((engine->io).hProcess,affin); -} - -// Eric Mullins! - void engine_set_nice_value(engine_t *engine, int value){ SetPriorityClass((engine->io).hProcess, GetWin32Priority(value)); } - void engine_send_queue(engine_t * engine,const char *szFormat, ...) { nQueuePtr += vsprintf(szQueueString + nQueuePtr, szFormat, (va_list) (&szFormat + 1)); } @@ -375,7 +378,6 @@ void engine_close(engine_t * engine){ (engine->io).Kill(); } - void engine_open(engine_t * engine){ int affinity; char *my_dir;