mirror of
https://github.com/shirou/gopsutil.git
synced 2025-05-08 19:29:25 +08:00
Merge pull request #1090 from MyaLongmire/windows_name_fix
simplify mutex usage
This commit is contained in:
commit
d87e955d79
@ -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
|
||||
@ -171,7 +171,6 @@ func NewProcess(pid int32) (*Process, error) {
|
||||
func NewProcessWithContext(ctx context.Context, pid int32) (*Process, error) {
|
||||
p := &Process{
|
||||
Pid: pid,
|
||||
parentMutex: new(sync.RWMutex),
|
||||
}
|
||||
|
||||
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
|
||||
@ -182,7 +182,6 @@ func NewProcess(pid int32) (*Process, error) {
|
||||
func NewProcessWithContext(ctx context.Context, pid int32) (*Process, error) {
|
||||
p := &Process{
|
||||
Pid: pid,
|
||||
parentMutex: new(sync.RWMutex),
|
||||
}
|
||||
|
||||
exists, err := PidExistsWithContext(ctx, pid)
|
||||
|
Loading…
x
Reference in New Issue
Block a user