Page 1 of 1

Why does copperspice use POSIX threads instead of C++11 and beyond

Posted: Sat Feb 29 2020 8:08 pm
by marlowa
Hello everyone,

I just found that copperspice makes direct calls to the POSIX pthreads functions (in the unix version). Why is that? I thought that copperspice was supposed to be using modern C++ which comes with all the synchronization primitives needed and in a portable way. I hope someone can explain why this is please?

Re: Why does copperspice use POSIX threads instead of C++11 and beyond

Posted: Sun Mar 01 2020 1:33 am
by barbara
copperspice makes direct calls to the POSIX pthreads functions
Yes, CopperSpice does currently use POSIX pthreads which do work properly. There are more modern ways to implement this functionality, however using POSIX has no barring on the fact that CopperSpice does use modern C+17 and a recent release of CMake.

It is on our road map to replace this with std::thread. There are however other items which have a high priority right now. If this is something you would like to work on and submit a pull request we would be more than happy to accept this.

Barbara

Re: Why does copperspice use POSIX threads instead of C++11 and beyond

Posted: Sun Mar 22 2020 5:26 pm
by marlowa
barbara wrote: Sun Mar 01 2020 1:33 am
copperspice makes direct calls to the POSIX pthreads functions
[snip] If this is something you would like to work on and submit a pull request we would be more than happy to accept this.

Barbara
I will have to decline. I have taken a look over this weekend and IMO it would be a tonne of work. It has been a long while since I did POSIX threads programming and I never used that part with keys that I think gives you TLS, so I wouldn't know how to map it to thread_local. Plus there is a big difference in the copperspice code between the threading and synchronization primitives with unix versus windows. Most of the unix stuff I understand but not the windows stuff. So I'm sorry, but I can't help.