Hello.
To use threads the same way in Windows and in Linux, I will use pevents:
https://github.com/neosmart/pevents
that emulates events the Windows way in Linux.
Someone has used it? It works well?
Many thanks.
threads
Moderators: hgm, Rebel, chrisw
-
- Posts: 2204
- Joined: Sat Jan 18, 2014 10:24 am
- Location: Andorra
threads
Daniel José - http://www.andscacs.com
-
- Posts: 855
- Joined: Sun May 23, 2010 1:32 pm
Re: threads
Hi dany,
I today don't use any windows/linux specific code using modern c++ threading libraries, they are present since C++11.
if you don't use C and use c++ I thin they are present in C11 too.
I today don't use any windows/linux specific code using modern c++ threading libraries, they are present since C++11.
if you don't use C and use c++ I thin they are present in C11 too.
-
- Posts: 1871
- Joined: Sat Nov 25, 2017 2:28 pm
- Location: France
Re: threads
For lazy smp, I guess stockfish implementation is the simplest one using c++11.
Easy example of use visible in Minic.
Easy example of use visible in Minic.
-
- Posts: 2488
- Joined: Tue Aug 30, 2016 8:19 pm
- Full name: Rasmus Althoff
Re: threads
I'm just using Posix-threads on Linux/Android and Win-API on Windows, with some ifdef wrapper functions.
If anything, I would use Posix under Windows (via MingW) because Windows is the only platform that needs something else. If you emulate Windows behaviour on Linux, then you have to test that thoroughly under Android, Mac and iOS. The potential for issues multiplies up. If you instead emulate Posix on Windows, than that's only one platform where you might run into non-native issues and find workarounds.
If anything, I would use Posix under Windows (via MingW) because Windows is the only platform that needs something else. If you emulate Windows behaviour on Linux, then you have to test that thoroughly under Android, Mac and iOS. The potential for issues multiplies up. If you instead emulate Posix on Windows, than that's only one platform where you might run into non-native issues and find workarounds.
Rasmus Althoff
https://www.ct800.net
https://www.ct800.net
-
- Posts: 4367
- Joined: Fri Mar 10, 2006 5:23 am
- Location: http://www.arasanchess.org
Re: threads
The C++11 stuff is almost portable, but if you need to set the thread stack size, it doesn't do that.
--Jon
-
- Posts: 2204
- Joined: Sat Jan 18, 2014 10:24 am
- Location: Andorra