Skip to content

fix+feat: protect global extrasymbol buffer with mutex for local poly… - #910

Open
jodavies wants to merge 1 commit into
form-dev:masterfrom
jodavies:issue-138
Open

jodavies wants to merge 1 commit into
form-dev:masterfrom
jodavies:issue-138

Conversation

@jodavies

Copy link
Copy Markdown
Collaborator

… conversion

This fixes #138 by having local polynomial conversions hold a mutex for the duration, to avoid corruption due to concurrent modifications of the global extrasymbol buffer.

This means that we can now also allow simultaneous use of global extrasymbols (ArgToExtraSymbol, ToPolynomial/FromPolynomial) and functions which trigger local conversion to polynomials: FactArg, FactDollar, gcd_, etc. Historically this has been forbidden in both FORM and TFORM, although FORM should not ever have had an issue. Presumably it was forbidden for both for consistency.

@coveralls

coveralls commented Sep 15, 2026 •

Copy link
Copy Markdown

Coverage Status

Coverage is 66.013% — jodavies:issue-138 into form-dev:master. No base build found for form-dev:master.

This fixes form-dev#138 by having local polynomial conversions use only thread-local
storage. We lock once, to store a copy of the global numxsymbol. After that
everything is local and no further locks are required for the local conversion.

This means that we can now also allow simultaneous use of global extrasymbols
(ArgToExtraSymbol, ToPolynomial/FromPolynomial) and functions which may trigger
local conversion to polynomials: FactArg, FactDollar, gcd_, etc. Historically
this has been forbidden in both FORM and TFORM, although FORM should not ever
have had an issue. Presumably it was forbidden for both for consistency.
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

Successfully merging this pull request may close these issues.

[tform] Wrong result from ToPolynomial and rational arithmetics with non-symbols

2 participants