Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-34986

Use RAII classes to manage locks

    XMLWordPrintable

Details

    Description

      Ticket for https://github.com/MariaDB/server/pull/3529 : while MariaDB is written in C+, it rarely uses C+'s advanced features for increased safety. The most important one is RAII, i.e. a single-purpose object manages acquiring and releasing a resource in its constructor/destructor. The destructor is guaranteed to be called, which means the compiler guarantees that the resource gets released when the scope is left, even when an exception is thrown (anywhere, even deeper down the stack). At runtime, this adds no overhead because the RAII object is optimized away.
      To get started, I suggest using such a RAII class for the `dict_sys` locks. Part of that was implemented by https://github.com/MariaDB/server/pull/3529

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              maxk Max Kellermann
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.