Skip to content

Make RegularExpression reentrant (thread safe)

RegularExpression used global variables shared by every instance. This made it impossible to use it concurrently even with independent instances.

By moving the once shared variables into a class on the stack RegularExpression becomes reentrant. That means that separate instances of RegularExpression can be used concurrently in different threads.

Additionally there is a new RegularExpressionMatch class that can be passed to a new two-argument RegularExpression::find() method. The new method is thread safe when used with separate RegularExpressionMatch instances. This allows to use the find() method of a single RegularExpression instance concurrently on different strings with independent RegularExpressionMatch results.

Merge request reports