Browse Source

adding processpriority

master
Michael Preisach 7 years ago
parent
commit
c32769fab5
  1. 19
      Cargo.lock
  2. 1
      Cargo.toml
  3. 7
      src/main.rs

19
Cargo.lock

@ -1,6 +1,25 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "libc"
version = "0.2.53"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "thread-priority"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.53 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "untitled"
version = "0.1.0"
dependencies = [
"thread-priority 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[metadata]
"checksum libc 0.2.53 (registry+https://github.com/rust-lang/crates.io-index)" = "ec350a9417dfd244dc9a6c4a71e13895a4db6b92f0b106f07ebbc3f3bc580cee"
"checksum thread-priority 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e655c097854cf47b40825a61c2edf7b96119ce9e02a9ff09e8b609b67f3c05e2"

1
Cargo.toml

@ -5,3 +5,4 @@ authors = ["Michael Preisach <michael@preisach.at>"]
edition = "2018"
[dependencies]
thread-priority = "0.1.0"

7
src/main.rs

@ -1,3 +1,5 @@
extern crate thread_priority;
use thread_priority::*;
use std::net::{TcpStream};
use std::io::prelude::*;
use std::io::{BufReader};
@ -11,6 +13,11 @@ use encoder::Encodestate;
pub static DEBUG: bool = false;
fn main() {
let thread_id = thread_native_id();
assert!(set_thread_priority(thread_id,
ThreadPriority::Max,
ThreadSchedulePolicy::Realtime(RealtimeThreadSchedulePolicy::RoundRobin)).is_ok());
let address = "192.168.1.77:8000";
let stream: TcpStream = TcpStream::connect(address).expect("connection failed");
let mut outstream = stream.try_clone().unwrap();

Loading…
Cancel
Save