Merge pull request #1090 from MyaLongmire/windows_name_fix

simplify mutex usage
pull/1091/head
shirou 4 years ago committed by GitHub
commit d87e955d79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -27,7 +27,7 @@ type Process struct {
name string
status string
parent int32
parentMutex *sync.RWMutex // for windows ppid cache
parentMutex sync.RWMutex // for windows ppid cache
numCtxSwitches *NumCtxSwitchesStat
uids []int32
gids []int32
@ -170,8 +170,7 @@ func NewProcess(pid int32) (*Process, error) {
func NewProcessWithContext(ctx context.Context, pid int32) (*Process, error) {
p := &Process{
Pid: pid,
parentMutex: new(sync.RWMutex),
Pid: pid,
}
exists, err := PidExistsWithContext(ctx, pid)

@ -27,7 +27,7 @@ type Process struct {
name string
status string
parent int32
parentMutex *sync.RWMutex // for windows ppid cache
parentMutex sync.RWMutex // for windows ppid cache
numCtxSwitches *NumCtxSwitchesStat
uids []int32
gids []int32
@ -181,8 +181,7 @@ func NewProcess(pid int32) (*Process, error) {
func NewProcessWithContext(ctx context.Context, pid int32) (*Process, error) {
p := &Process{
Pid: pid,
parentMutex: new(sync.RWMutex),
Pid: pid,
}
exists, err := PidExistsWithContext(ctx, pid)

Loading…
Cancel
Save