def create_tmpdir
      td = tls[:tmpdir]
      if td.nil?
        td = ::Dir.mktmpdir
        tls[:tmpdir] = td
        created = true
      else
        created = false
      end
      return [td, created]
    end
def create_tmpdir
      td = tls[:tmpdir]
      if td.nil?
        td = ::Dir.mktmpdir
        tls[:tmpdir] = td
        created = true
      else
        created = false
      end
      return [td, created]
    end
factory method for tmpdir (convenient for testing).