# File lib/mongo/cluster/reapers/cursor_reaper.rb, line 112
      def kill_cursors
        to_kill_copy = {}
        active_cursors_copy = []

        @mutex.synchronize do
          to_kill_copy = @to_kill.dup
          active_cursors_copy = @active_cursors.dup
          @to_kill = {}
        end

        to_kill_copy.each do |server, op_specs|
          op_specs.each do |op_spec|
            if server.features.find_command_enabled?
              Cursor::Builder::KillCursorsCommand.update_cursors(op_spec, active_cursors_copy.to_a)
              if Cursor::Builder::KillCursorsCommand.get_cursors_list(op_spec).size > 0
                Operation::KillCursors.new(op_spec).execute(server)
              end
            else
              Cursor::Builder::OpKillCursors.update_cursors(op_spec, active_cursors_copy.to_a)
              if Cursor::Builder::OpKillCursors.get_cursors_list(op_spec).size > 0
                Operation::KillCursors.new(op_spec).execute(server)
              end
            end
          end
        end
      end