dfhack icon indicating copy to clipboard operation
dfhack copied to clipboard

WIP (pending testing): Remove tinythread as a dependency

Open ProgRockJazz opened this issue 2 years ago • 5 comments

Closes https://github.com/DFHack/dfhack/issues/2514

As tinythread was meant to implement the C++11 concurrency library very closely, moving from tinythread to C++11 threads was mostly trivial replacement of tthread scoped types with std ones. condition_variable's wait() in the std library uses a unique_lock instead of a mutex pointer so some instances required adding a unique_lock. However, the switch over to using unique_locks doesn't change anything as a mutex has to be held by the calling thread to a condvar wait anyways.

Some of the changes are in currently unbuilt plugins, so it may be pertinent to test those changes on the v47.05r8 build of DFHack.

ProgRockJazz avatar Dec 21 '22 05:12 ProgRockJazz

while you're at it can you fix ruby's broken locking (lol, just kidding)

ab9rf avatar Dec 21 '22 05:12 ab9rf

My 2¢: every change here should be tested thoroughly before merging. 0.47.05 should be fine. Ideally Windows and Linux, just to be sure it works with both stdlibs we use. We have run into inadvertent deadlocks due to threading changes before, and while I don't expect anything here, it's quite possible that switching libraries may cause some race condition to surface.

lethosor avatar Dec 21 '22 05:12 lethosor

My 2¢: every change here should be tested thoroughly before merging. 0.47.05 should be fine. Ideally Windows and Linux, just to be sure it works with both stdlibs we use. We have run into inadvertent deadlocks due to threading changes before, and while I don't expect anything here, it's quite possible that switching libraries may cause some race condition to surface.

I definitely agree; I personally I am not super well versed in the nominal behavior of DFHack, so my ability to sniff out incorrect behavior by myself is a bit lacking. I do have the ability to build on Windows, Mac, and Linux so I will try out the changes on different platforms on 47.05 when I get the chance.

ProgRockJazz avatar Dec 21 '22 05:12 ProgRockJazz

I have made a branch with these changes rebased on top of the 0.47.05-r8 tag for testing: excise-tinythread-v47. This also includes the changes to get protobuf to compile on vs2022 and fixing/ignoring two misc. errors that were being thrown by msvc unrelated to my tinythreads changes.

ProgRockJazz avatar Dec 22 '22 00:12 ProgRockJazz

ruby has been removed. you might need to update this PR

myk002 avatar Jan 27 '23 22:01 myk002

I'd like to see this merged too.

dhthwy avatar Dec 24 '23 16:12 dhthwy

i'm pretty sure paxman isn't around anymore (haven't seen them in months), so someone else needs to take ownership of this PR if we want it merged

ab9rf avatar Dec 24 '23 19:12 ab9rf

Hi everyone! Apologies for the disappearing act. I'm glad that this is being looked at again though. I'll take a look at the new pr and see if there is anything I can help with.

ProgRockJazz avatar Dec 28 '23 16:12 ProgRockJazz

It's no problem. You'll still be credited for your work, of course, if the new PR gets in.

dhthwy avatar Dec 28 '23 16:12 dhthwy

@paxman101 yeah, my plan is to merge the original commits from both PRs so the attribution of your work is "pure"

myk002 avatar Dec 28 '23 23:12 myk002

included in https://github.com/DFHack/dfhack/pull/4106

myk002 avatar Dec 31 '23 00:12 myk002