# File lib/zfstools.rb, line 145
def do_new_snapshots(datasets, interval)
  snapshot_name = snapshot_name(interval)

  threads = []
  # Snapshot single
  datasets['single'].each do |dataset|
    threads << Thread.new do
      Zfs::Snapshot.create("#{dataset.name}@#{snapshot_name}", 'db' => dataset.db)
    end
    threads.last.join unless $use_threads
  end

  # Snapshot recursive
  datasets['recursive'].each do |dataset|
    threads << Thread.new do
      Zfs::Snapshot.create("#{dataset.name}@#{snapshot_name}", 'recursive' => true, 'db' => dataset.db)
    end
    threads.last.join unless $use_threads
  end

  threads.each { |th| th.join }
end