Documentation ¶
Overview ¶
进程管理/通信. 本进程管理从syscall, os.StartProcess, exec.Cmd都使用过, 最后采用了exec.Cmd来实现多进程管理,这是一个顶层的跨平台封装,兼容性更好,另外两个是偏底层的接口。
进程管理.
Index ¶
- func IsChild() bool
- func PPid() int
- func PPidOS() int
- func Pid() int
- func Send(pid int, data []byte) error
- func SetPPid(ppid int)
- func StartTime() time.Time
- func Uptime() int
- type Manager
- func (m *Manager) AddProcess(pid int)
- func (m *Manager) Clear()
- func (m *Manager) GetProcess(pid int) *Process
- func (m *Manager) KillAll() error
- func (m *Manager) NewProcess(path string, args []string, environment []string) *Process
- func (m *Manager) Pids() []int
- func (m *Manager) Processes() []*Process
- func (m *Manager) RemoveProcess(pid int)
- func (m *Manager) Send(data []byte)
- func (m *Manager) SendTo(pid int, data []byte) error
- func (m *Manager) SignalAll(sig os.Signal) error
- func (m *Manager) Size() int
- func (m *Manager) WaitAll()
- type Msg
- type Process
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
进程管理器
func (*Manager) NewProcess ¶
创建一个进程(不执行)
type Process ¶
子进程
func NewProcess ¶
创建一个进程(不执行)
func (*Process) Release ¶
Release releases any resources associated with the Process p, rendering it unusable in the future. Release only needs to be called if Wait is not.
Click to show internal directories.
Click to hide internal directories.