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

better document thread safety of BSONObj

    XMLWordPrintableJSON

Details

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

    Description

      There's a comment at the top of BSONObj about thread safety that seems out of date.

             Note that BSONObj's have a smart pointer capability built in -- so you can
             pass them around by value.  The reference counts used to implement this
             do not use locking, so copying and destroying BSONObj's are not thread-safe
             operations.

      It looks like references are counted via AtomicUInt so the counting seems thread safe. And it looks like the thread safety rules are similar to those for shared_ptr, but it would be good to check that and document.

      Attachments

        Activity

          People

            backlog-server-platform DO NOT USE - Backlog - Platform Team
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: