Uploaded image for project: 'Xerces-C++'
  1. Xerces-C++
  2. XERCESC-2140

Add MutexMgr for C++11 mutex implementation

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.2.1
    • 3.2.2
    • Utilities
    • None
    • Patch

    Description

      Xalan currently supports two mutex managers: POSIX and Windows (and NoThreads, which doesn't really count).  With the advent of C+11, it's no longer necessary to use platform-specific threading facilities, since it's built directly into the standard library.  The attached patch adds a StdMutexMgr which uses a C+11 mutex, and will work on Unix or Windows systems with a sufficiently new compiler.  thread/mutex were implemented years ago, so all recent and not so recent systems should support it.  For those that don't, it will fall back to the POSIX/Windows managers and behave like before.

       

      Options have been added to manually select the desired manager as for other options for both cmake and autoconf (standard/posix/windows/nothreads).  Documented in more detail on the build page.

       

      It's tested on Linux/MacOS X/Windows with a variety of manager combinations, and all looks fine so far.  Any testing/comments much appreciated.  It's a compatible addition, so could go into 3.2.2 if that's acceptable, otherwise could wait for later.

       

      Looking at all of the manager implementations, one key defect (likely intentional design), is that there is zero exception safety.  No currently held mutex will be released if an exception gets thrown.  That could be prevented by moving to using C++11 threading entirely, and using std::lock_guard, which will automatically release locks on unwind.

      Attachments

        Activity

          People

            rleigh Roger Leigh
            rleigh Roger Leigh
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: