Multithreading - sharing C++ code between Windows and Linux
Posted: 29 Dec 2008, 22:31
I am fairly experienced with multithreaded C++ programming in Windows. Until today I thought that true multithreading (as opposed to multiple processes with separate address space) was not available in Linux. However, I did a little research and discovered the Native POSIX Threading Library (NPTL):
http://www.ddj.com/linux-open-source/184406204
http://en.wikipedia.org/wiki/Native_POS ... ad_Library
I now have a few simple test programs using NPTL compiling with gcc on my Ubuntu box.
The obvious next step for me as a chess programmer is to ask, how can I write C++ code that will enable multithreading in my chess engine and will compile in both Windows and Linux? The obvious thing is to learn NPTL, then write my own small class library with conditional compilation to hide the differences between Windows and Linux: creating threads, mutex locking, etc.
But first I thought I would ask here to see if there is a more elegant way, for example an already coded and debugged library.
Thanks in advance for any ideas!
http://www.ddj.com/linux-open-source/184406204
http://en.wikipedia.org/wiki/Native_POS ... ad_Library
I now have a few simple test programs using NPTL compiling with gcc on my Ubuntu box.
The obvious next step for me as a chess programmer is to ask, how can I write C++ code that will enable multithreading in my chess engine and will compile in both Windows and Linux? The obvious thing is to learn NPTL, then write my own small class library with conditional compilation to hide the differences between Windows and Linux: creating threads, mutex locking, etc.
But first I thought I would ask here to see if there is a more elegant way, for example an already coded and debugged library.
Thanks in advance for any ideas!