Multi-threading
| Name | Description |
|---|---|
| capability | |
| flags | |
| sched |
| Kind | Name | Description |
|---|---|---|
| Struct | Builder | A thread-builder |
| Struct | CapSet | A thread's capability set. |
| Struct | Capability | A Linux capability. |
| Struct | CpuMask | A bit-mask of CPUs. |
| Struct | GroupIds | Group ids of a thread. |
| Struct | JoinGuard | A join-guard |
| Struct | SchedAttr | Scheduler attributes. |
| Struct | SchedFlags | Flags for schedulers. |
| Struct | Scheduler | A process scheduler. |
| Struct | UserIds | User ids of a thread. |
| Name | Description |
|---|---|
| capabilities | Returns the capabilities of a thread. |
| cpu_count | Returns the number of CPUs available to this thread. |
| cpus | Returns the CPU mask of a thread. |
| current_cpu | Returns the CPU the thread is currently running on. |
| deschedule | Relinquish the CPU. |
| drop_bounding_cap | Removes a capability from this thread's bounding set. |
| drop_group_privileges | Sets all group ids of this thread to the real id. |
| drop_user_privileges | Sets all user ids of this thread to the real id. |
| enter_strict_mode | Enables strict seccomp mode for this thread. |
| exit | Terminates the current thread. |
| group_niceness | Returns the niceness of a process group. |
| has_bounding_cap | Checks whether a capability is in the bounding set of this thread. |
| join_namespace | Associates this thread with a namespace. |
| keeps_caps | Returns whether this thread keeps its permitted capabilities when all |
| num_supplementary_groups | Returns the number of supplementary groups of this thread. |
| process_niceness | Returns the niceness of a process. |
| scheduler | Get a thread's scheduler and its arguments. |
| scoped | Spawns a new scoped thread. |
| set_capabilities | Sets the capabilities of the current thread. |
| set_cpus | Sets the CPU mask of a thread. |
| set_effective_group_id | Sets the effective group id of this thread. |
| set_effective_user_id | Sets the effective user id of this thread. |
| set_group_niceness | Sets the niceness of a process group. |
| set_keeps_caps | Sets whether this thread keeps its permitted capabilities when all |
| set_process_niceness | Sets the niceness of a process. |
| set_scheduler | Set a thread's scheduler and its arguments. |
| set_supplementary_groups | Sets the supplementary groups of this thread. |
| set_user_niceness | Sets the niceness of a user. |
| spawn | Spawns a new thread. |
| supplementary_groups | Retrieves the supplementary groups of this thread. |
| thread_id | Returns the thread id of the calling thread. |
| unshare | Disassociate parts of the thread's execution context. |
| user_niceness | Returns the niceness of a user. |
let mut array = [1u8; 1024];
{
let res = scoped(|| {
println!("getting to work");
for i in 0..SIZE {
array[i] = 2;
}
println!("done working");
});
println!("joining");
res.unwrap();
println!("joined");
}
for i in 0..SIZE {
assert!(array[i] == 2);
}