Uploaded image for project: 'Swift'
  1. Swift
  2. SR-946

Unify mutexes in the Swift runtime

    XMLWordPrintable

    Details

      Description

      The Swift runtime uses two different mutexes internally. Neither one is good. We should write a new swift::mutex or adopt some LLVM mutex that solves these problems.

      Some code uses C++ std::mutex. This mutex throws exceptions when errors occur. Nobody can reasonably catch and respond to these errors. Backtraces are lost when these exceptions are caught and re-thrown before the process halts (such as rdar://25058486, probably).

      Some code uses pthread_mutex_t. This mutex returns non-zero when errors occur. Our code does not check these errors.

      The new mutex implementation should:

      • use pthread_mutex_t or some LLVM mutex if a suitable one is available
      • implement C++ STL's BasicLockable and Lockable
      • halt using swift::reportError when a failure occurs
      • not throw exceptions

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            gparker Greg Parker
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: