Documentation ¶
Overview ¶
Package gproc implements communication and management of processes.
进程管理/通信, 本进程管理从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, group ...string) error
- func SetPPid(ppid int)
- func Shell(cmd string, out io.Writer, in io.Reader) error
- func ShellExec(cmd string) (string, error)
- func ShellRun(cmd string) error
- 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 ¶
func Send ¶
向指定gproc进程发送数据. 数据格式:总长度(24bit)|发送进程PID(24bit)|接收进程PID(24bit)|分组长度(8bit)|分组名称(变长)|校验(32bit)|参数(变长)
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.