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

Discuss anything related to product development
Post Reply
marlowa
Posts: 115
Joined: Sun Oct 25 2015 10:52 am

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

Post 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?

barbara
Posts: 201
Joined: Sat Apr 04 2015 2:32 am

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

Post 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

marlowa
Posts: 115
Joined: Sun Oct 25 2015 10:52 am

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

Post 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.

Post Reply