mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-07 05:10:23 +09:00
34 lines
501 B
Go
34 lines
501 B
Go
package main
|
|
|
|
import "syscall"
|
|
|
|
func (v *View) Suspend(usePlugin bool) bool {
|
|
if usePlugin && !PreActionCall("Suspend", v) {
|
|
return false
|
|
}
|
|
|
|
screenWasNil := screen == nil
|
|
|
|
if !screenWasNil {
|
|
screen.Fini()
|
|
screen = nil
|
|
}
|
|
|
|
// suspend the process
|
|
pid := syscall.Getpid()
|
|
tid := syscall.Gettid()
|
|
err := syscall.Tgkill(pid, tid, syscall.SIGSTOP)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
if !screenWasNil {
|
|
InitScreen()
|
|
}
|
|
|
|
if usePlugin {
|
|
return PostActionCall("Suspend", v)
|
|
}
|
|
return true
|
|
}
|