Skip to content

Commit

Permalink
Merge pull request #1090 from MyaLongmire/windows_name_fix
Browse files Browse the repository at this point in the history
simplify mutex usage
  • Loading branch information
shirou committed Jun 29, 2021
2 parents daec167 + cb512c8 commit d87e955
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions v3/process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d87e955

Please sign in to comment.