Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-4220

Consider removal of obsolete sync implementation code

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 1.29.0
    • Affects Version/s: None
    • Component/s: None
    • Fully Compatible
    • Not Needed

      In poking around at bson-compat.h, I noticed this section of code:

      #if defined(__GNUC__)
      #if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
      #define bson_sync_synchronize() __sync_synchronize ()
      #elif defined(__i386__) || defined(__i486__) || defined(__i586__) || \
         defined(__i686__) || defined(__x86_64__)
      #define bson_sync_synchronize() asm volatile("mfence" ::: "memory")
      #else
      #define bson_sync_synchronize() asm volatile("sync" ::: "memory")
      #endif
      #elif defined(_MSC_VER)
      #define bson_sync_synchronize() MemoryBarrier ()
      #endif
      
      

      The conditional around whether or not to use __sync_synchronize () is based on a GCC version of 4.1. However, the oldest GCC version we use (e.g., for building/testing in Evergreen) is 4.4 on RHEL 6 and 4.8 on Ubuntu 14.04. That would make most of this conditional obsolete and we should consider removal of the dead branches.

            Assignee:
            micah.scott@mongodb.com Micah Scott
            Reporter:
            roberto.sanchez@mongodb.com Roberto Sanchez
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: