// Destroy sends quit signal to watcher and releases all the resources.
505714
func (logger *Logger) Destroy() {
	if !logger.sync {
		// quit watcher
		logger.quit <- true
		// wait for watcher quit
		<-logger.quit
	}
	// clean up
	if logger.fd != nil {
		logger.fd.Close()
	}
}
891838
func (a *Application) Destroy() (err error) {
	defer func() {
		logger.Tracef("Application(%s).Destroy() => %v", a.doc.Name, err)
		if err == nil {
			// This is a white lie; the document might actually be removed.
			a.doc.Life = Dying
		}
	}()
	return a.st.ApplyOperation(a.DestroyOperation())
}
779468
func (vm *VM) Destroy() error {
	s, err := vm.getService()
	if err != nil {
		return err
	}

	return s.delete()
}
685458
func (w *Window) Destroy() {
	if !w.Destroyed {
		w.Detach()
		err := xproto.DestroyWindowChecked(w.X.Conn(), w.Id).Check()
		if err != nil {
			xgbutil.Logger.Println(err)
		}

		w.Destroyed = true
	}
}
201838
func (n *Node) Destroy() {
	n.state.Lock()
	if n.state.destroyed {
		n.state.Unlock()
		return
	}
	n.state.destroyed = true
	n.state.Unlock()

	n.Stop()
}
929710
func (s *Semaphore) Destroy() error {
	// Hold the lock as we try to acquire
	s.l.Lock()
	defer s.l.Unlock()

	// Check if we already hold the semaphore
	if s.isHeld {
		return ErrSemaphoreHeld
	}

	// List for the semaphore
	kv := s.c.KV()
	pairs, _, err := kv.List(s.opts.Prefix, nil)
	if err != nil {
		return fmt.Errorf("failed to read prefix: %v", err)
	}

	// Find the lock pair, bail if it doesn't exist
	lockPair := s.findLock(pairs)
	if lockPair.ModifyIndex == 0 {
		return nil
	}
	if lockPair.Flags != SemaphoreFlagValue {
		return ErrSemaphoreConflict
	}

	// Decode the lock
	lock, err := s.decodeLock(lockPair)
	if err != nil {
		return err
	}

	// Prune the dead holders
	s.pruneDeadHolders(lock, pairs)

	// Check if there are any holders
	if len(lock.Holders) > 0 {
		return ErrSemaphoreInUse
	}

	// Attempt the delete
	didRemove, _, err := kv.DeleteCAS(lockPair, nil)
	if err != nil {
		return fmt.Errorf("failed to remove semaphore: %v", err)
	}
	if !didRemove {
		return ErrSemaphoreInUse
	}
	return nil
}
901354
func (s *RemoteApplication) Destroy() error {
	_, err := s.DestroyWithForce(false, time.Duration(0))
	return err
}
547243
func (vm *VM) Destroy() error {
	err := vm.Halt()
	if err != nil {
		return err
	}

	// vbox will not release it's lock immediately after the stop
	time.Sleep(1 * time.Second)

	_, err = runner.RunCombinedError("unregistervm", vm.Name, "--delete")
	if err != nil {
		return lvm.WrapErrors(lvm.ErrDeletingVM, err)
	}
	return nil
}
278565
func (w *Watcher) Close() error {
	w.closedMutex.Lock()
	defer w.closedMutex.Unlock()

	if w.isClosed {
		return nil
	}
	w.isClosed = true

	w.watchesMutex.Lock()
	for pid := range w.watches {
		delete(w.watches, pid)
		w.unregister(pid)
	}
	w.watchesMutex.Unlock()

	w.done <- true

	w.listener.close()

	return nil
}
627047
func (w *Watcher) Close() error {
	w.mu.Lock()
	if w.isClosed {
		w.mu.Unlock()
		return nil
	}
	w.isClosed = true
	w.mu.Unlock()

	// Send "quit" message to the reader goroutine
	w.done <- true
	w.wmut.Lock()
	ws := w.watches
	w.wmut.Unlock()
	for path := range ws {
		w.removeWatch(path)
	}

	return nil
}
8039
func (window *Window) Destroy() error {
	lastErr := GetError()
	ClearError()
	C.SDL_DestroyWindow(window.cptr())
	err := GetError()
	if err != nil {
		return err
	}
	SetError(lastErr)
	return nil
}
55635
func (c *Compiler) Destroy() {
	c.setCallbackData(nil)
	if c.compiler != nil {
		c.compiler.finalize()
		c.compiler = nil
	}
}
1167581
func (n *NomadAgent) Destroy() error {
	if err := n.Stop(); err != nil {
		return err
	}
	return os.RemoveAll(n.DataDir)
}
350934
func (s *Session) Destroy() {
	s.MaxAge = -1
	s.Expires = time.Now()
	s.data = make(map[interface{}]interface{})
	s.isDirty = true
}
534742
func (_class NetworkSriovClass) Destroy(sessionID SessionRef, self NetworkSriovRef) (_err error) {
	_method := "network_sriov.destroy"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertNetworkSriovRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
	if _err != nil {
		return
	}
	_, _err =  _class.client.APICall(_method, _sessionIDArg, _selfArg)
	return
}
372388
func (nw *NotifyWorker) tearDown(err error) {
	nw.catacomb.Kill(err)
	err = nw.config.Handler.TearDown()
	nw.catacomb.Kill(err)
}
291808
func (opts *ReadOptions) Destroy() {
	C.rocksdb_readoptions_destroy(opts.c)
	opts.c = nil
}