Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • K KWSys
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Merge requests 1
    • Merge requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • Utils
  • KWSys
  • Merge requests
  • !72

Make RegularExpression reentrant (thread safe)

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Sebastian Holtermann requested to merge sebholt/kwsys:regular-expression-thread-safe into master Dec 04, 2017
  • Overview 9
  • Commits 4
  • Pipelines 1
  • Changes 2

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.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: regular-expression-thread-safe