Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-9422

audit MONGO_FILE_LINE macro

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • None
    • None
    • Internal Code
    • None

    Description

      Make sure all parts of the macro added to mutex.h should be there:

      commit: 9b37a3aa83655aa92c1d466e65500100e4d799cd

      Code from mutex.h included here:

      // Macro to get line as a string constant
      #define MONGO_STRINGIFY(X) #X
      // Double-expansion trick to get preproc to actually substitute __LINE__
      #define _MONGO_LINE_STRING(LINE) MONGO_STRINGIFY( LINE )
      #define MONGO_LINE_STRING _MONGO_LINE_STRING( __LINE__ )
       
      // Mutex names should be as <file>::<line> string
      #define MONGO_FILE_LINE __FILE__ "::" MONGO_LINE_STRING

      Background - every mutex created needs a unique name (which is only used for debugging), and it's kind of a pain to keep the names up-to-date when classes get moved and refactored (particularly when doing initial coding). Instead, we can just use the file/line of the mutex initialization. dbclient.cpp is an example where the mutex names are a bit ad-hoc, have seen other places.

      Suggestion - move to compiler.h, since this is not necessarily mutex specific?

      Attachments

        Activity

          People

            schwerin@mongodb.com Andy Schwerin
            greg_10gen Greg Studer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: