sba1 / adtools

Experimental GNU toolchain for AmigaOS
31 stars 18 forks source link

Fix to exception raised by Callable in call_once #127

Closed 3246251196 closed 1 year ago

3246251196 commented 1 year ago

Based on MorphOS implementation: catch the potential exception in Callable, and when doing so, reset the flag allowing other threads calling the same callable to complete Callable.

Not extensive testing, only the code/test in https://en.cppreference.com/w/cpp/thread/call_once which was previously causing thread (Amiga Task) to become stuck waiting for the release of the shared resource (call_once flag).

== PS: Just updated this initial comment because a lot of detail was there explaining how you have to patch gthr-amiga-native.cpp which we no longer need to do since we have updated to 54.16 SDK.

sba1 commented 1 year ago

Thanks! Can you please add the test also the adtools test folder?

3246251196 commented 1 year ago

@sba1 Hi, I have added a test, added the expected output and made changes to the makefile. But, I do not have QEMU set up, so I am making those changes blindly.

sba1 commented 1 year ago

Thanks! The test is enough for now. I think that the changes can be squashed with the previous patch that introduces this thread model though. However, this can be done later.

3246251196 commented 1 year ago

Yes, that would be beneficial because it would then become implicit in previous versions of GCC. at the moment, this is only for GCC11. But, perhaps it is not a bad thing. This patch has not had extensive testing, after a while - if it holds up - we can squash it then.