Cross Platform Multi-Threading Libraries - Help needed
Posted: 16 Jan 2006, 18:35
I'm actively developing Monarch once again and I've nearly completed a substantial re-write of many fundamental routines (removing color dependency and assembly code). One thing I'd like to do is to make the code more portable across platforms - especially Linux and Mac. The main obstacle to this is the multi threaded code in Monarch. I have the engine calculate in one thread and I 'listen' for input in another. I realize that I could avoid this complication and do everything in a single thread (like Fruit and Glaurung) but eventually I'd like to make Monarch multi-threaded so I decided to create a separate thread for the engine from day one. Can anyone advise me on the best way to do this?
Here are the multi-threading routines I use under Windows.
Are there any (free) cross-platform libraries that I can use to replace these routines? Which one would be the best fit for this purpose?
At the same time I'd also like to add a routine to measure and display at the end of the search the CPU time utilized by Monarch (like Shredder and Fruit). Is this easy? Any pointers?
All help appreciated?
Steve
Here are the multi-threading routines I use under Windows.
- Code: Select all
thread_handle = (HANDLE)_beginthreadex( NULL, 0, &engine_loop, NULL, 0, &threadID );
aPriority = GetThreadPriority(GetCurrentThread());
SetThreadPriority(thread_handle, aPriority);
_endthreadex(0);
WaitForSingleObject(thread_handle, INFINITE);
Are there any (free) cross-platform libraries that I can use to replace these routines? Which one would be the best fit for this purpose?
At the same time I'd also like to add a routine to measure and display at the end of the search the CPU time utilized by Monarch (like Shredder and Fruit). Is this easy? Any pointers?
All help appreciated?
Steve