Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fp64lib is incompatible with multi-threaded code #15

Closed
sprintersb opened this issue Nov 12, 2023 · 1 comment
Closed

fp64lib is incompatible with multi-threaded code #15

sprintersb opened this issue Nov 12, 2023 · 1 comment

Comments

@sprintersb
Copy link

There are modules like power series (p64_powserx.S) that are using static storage (STS/LDS) to temporarily store state.

This means that fp64lib cannot be used in multi-threaded programs, because one thread may override data of some other thread. There are more functions that are not re-entrant like in: fp64_asinx.S, fp64_sinx.S, fp64_tostring.S, fp64_strtod.S.

Modules fp64_stackB.S and fp64_stackC.S are using the same anti-pattern and are used by many other modules.

@fp64lib
Copy link
Owner

fp64lib commented Nov 18, 2023

The code being not threadsafe was a deliberately taken design decision, see https://fp64lib.org/documentation/fp64lib-design-principles/, topic #7 and #9. The reason was to have the smallest possible footprint, so that the complete library can be used on an Arduino Uno leaving enough memory for a typical application like a calculator or a GPS tracker.

@fp64lib fp64lib closed this as completed Nov 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants