apiMessages.send = function (req, res) {
  var payload = req.body
  var cId = payload.cId
  var owner = payload.owner
  var message = payload.body
  var matches = message.match(/^[Tt]#[0-9]*$/g)

  if (!_.isNull(matches) && matches.length > 0) {
    _.each(matches, function (m) {
      message = message.replace(
        m,
        '<a href="/tickets/' +
          m.replace('T#', '').replace('t#', '') +
          '">T#' +
          m.replace('T#', '').replace('t#', '') +
          '</a>'
      )
    })
  }

  async.waterfall(
    [
      function (done) {
        ConversationSchema.findOne({ _id: cId }, function (err, convo) {
          if (err || !convo) return done('Invalid Conversation')

          return done(null, convo)
        })
      },
      function (convo, done) {
        // Updated conversation to save UpdatedAt field.
        convo.updatedAt = new Date()
        convo.save(function (err, savedConvo) {
          if (err) return done(err)

          return done(null, savedConvo)
        })
      },
      function (convo, done) {
        UserSchema.findOne({ _id: owner }, function (err, user) {
          if (err || !user) return done('Invalid Conversation')

          return done(null, user, convo)
        })
      },
      function (user, convo, done) {
        const Message = new MessageSchema({
          conversation: convo._id,
          owner: user._id,
          body: message
        })

        Message.save(function (err, mSave) {
          if (err) {
            return done(err)
          }

          // Update conversation Meta!!
          return done(null, mSave)
        })
      }
    ],
    function (err, mSave) {
      if (err) {
        winston.debug(err)
        return res.status(400).json({ success: false, error: err.message })
      }
      return res.json({ success: true, message: mSave })
    }
  )
}
The software utilizes multiple threads or processes to allow temporary access to a shared resource that can only be exclusive to one process at a time, but it does not properly synchronize these actions, which might cause simultaneous accesses of this resource by multiple threads or processes.