Skip to content

Commit 2a60b91

Browse files
Merge pull request #14 from dalance/pidinfo_for_threadinfo
Implement PIDInfo trait for ThreadInfo
2 parents 9444119 + e1a3111 commit 2a60b91

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/libproc/proc_pid.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,28 @@ pub struct ThreadInfo {
130130
pub pth_name : [c_char; MAXTHREADNAMESIZE] // thread name, if any
131131
}
132132

133+
impl PIDInfo for ThreadInfo {
134+
fn flavor() -> PidInfoFlavor { PidInfoFlavor::ThreadInfo }
135+
}
136+
137+
impl Default for ThreadInfo {
138+
fn default() -> ThreadInfo {
139+
ThreadInfo {
140+
pth_user_time : 0,
141+
pth_system_time: 0,
142+
pth_cpu_usage : 0,
143+
pth_policy : 0,
144+
pth_run_state : 0,
145+
pth_flags : 0,
146+
pth_sleep_time : 0,
147+
pth_curpri : 0,
148+
pth_priority : 0,
149+
pth_maxpriority: 0,
150+
pth_name : [0; MAXTHREADNAMESIZE],
151+
}
152+
}
153+
}
154+
133155
#[derive(Default)]
134156
pub struct WorkQueueInfo {
135157
pub pwq_nthreads : uint32_t, // total number of workqueue threads

0 commit comments

Comments
 (0)