|
|
@@ -189,26 +189,23 @@ impl AbstractWsMode {
|
|
|
Ok::<(), Error>(())
|
|
|
};
|
|
|
|
|
|
- // // 防止 cpu 休眠。
|
|
|
- // let read2 = read_arc.clone();
|
|
|
- // spawn(async move {
|
|
|
- // let t_str = "t".to_string();
|
|
|
- // let response = ResponseData::new(t_str.clone(),
|
|
|
- // t_str.clone(),
|
|
|
- // t_str.clone(),
|
|
|
- // t_str.clone());
|
|
|
- // loop {
|
|
|
- // time::sleep(Duration::from_nanos(1)).await;
|
|
|
- //
|
|
|
- // let t = response.clone();
|
|
|
- // let r = read2.clone();
|
|
|
- // spawn(async move {
|
|
|
- // let read = r.lock().await;
|
|
|
- //
|
|
|
- // read.unbounded_send(t.clone()).unwrap();
|
|
|
- // });
|
|
|
- // }
|
|
|
- // });
|
|
|
+ // 防止 cpu 休眠。
|
|
|
+ let read2 = read_arc.clone();
|
|
|
+ spawn(async move {
|
|
|
+ let t_str = "t".to_string();
|
|
|
+ let response = ResponseData::new(t_str.clone(),
|
|
|
+ t_str.clone(),
|
|
|
+ t_str.clone(),
|
|
|
+ t_str.clone());
|
|
|
+ loop {
|
|
|
+ tokio::time::sleep(Duration::from_micros(1)).await;
|
|
|
+
|
|
|
+ let t = response.clone();
|
|
|
+ let r = read2.clone();
|
|
|
+ let read = r.lock().await;
|
|
|
+ read.unbounded_send(t.clone()).unwrap();
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
//必须操作。,因为不同于其他的高级语言,有自动内存管理,所以为了防范地址改变,所以需要做此处理
|
|
|
pin_mut!(stdin_to_ws, ws_to_stdout,);
|