Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-75

Use defer for mutex unlocking

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 0.0.1
    • None
    • None
    • None

    Description

      Much of the monitoring code I've looked at relies on manual mutex unlocking. This is not generally idiomatic Go (except in hot code paths) and leads to errors, as shown in GODRIVER-74. Until we know there's a performance problem caused by defer, avoiding defer is premature optimization that increases the likelihood of bugs.

      We should change all unlocking to use defer when possible. (N.B. For whoever does this work: note that it's not possible inside a for loop, as defer is function scoped, not loop scoped.)

      Attachments

        Activity

          People

            sam.rossi@mongodb.com Samuel Rossi (Inactive)
            david.golden@mongodb.com David Golden
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: