diff options
Diffstat (limited to 'crates/ra_lsp_server/src/thread_watcher.rs')
-rw-r--r-- | crates/ra_lsp_server/src/thread_watcher.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/crates/ra_lsp_server/src/thread_watcher.rs b/crates/ra_lsp_server/src/thread_watcher.rs index 51b35fa66..5143c77ae 100644 --- a/crates/ra_lsp_server/src/thread_watcher.rs +++ b/crates/ra_lsp_server/src/thread_watcher.rs | |||
@@ -17,8 +17,7 @@ impl<I, O> Worker<I, O> { | |||
17 | I: Send + 'static, | 17 | I: Send + 'static, |
18 | O: Send + 'static, | 18 | O: Send + 'static, |
19 | { | 19 | { |
20 | let ((inp, out), inp_r, out_s) = worker_chan(buf); | 20 | let (worker, inp_r, out_s) = worker_chan(buf); |
21 | let worker = Worker { inp, out }; | ||
22 | let watcher = ThreadWatcher::spawn(name, move || f(inp_r, out_s)); | 21 | let watcher = ThreadWatcher::spawn(name, move || f(inp_r, out_s)); |
23 | (worker, watcher) | 22 | (worker, watcher) |
24 | } | 23 | } |
@@ -67,11 +66,14 @@ impl ThreadWatcher { | |||
67 | /// Sets up worker channels in a deadlock-avoind way. | 66 | /// Sets up worker channels in a deadlock-avoind way. |
68 | /// If one sets both input and output buffers to a fixed size, | 67 | /// If one sets both input and output buffers to a fixed size, |
69 | /// a worker might get stuck. | 68 | /// a worker might get stuck. |
70 | fn worker_chan<I, O>(buf: usize) -> ((Sender<I>, Receiver<O>), Receiver<I>, Sender<O>) { | 69 | fn worker_chan<I, O>(buf: usize) -> (Worker<I, O>, Receiver<I>, Sender<O>) { |
71 | let (input_sender, input_receiver) = bounded::<I>(buf); | 70 | let (input_sender, input_receiver) = bounded::<I>(buf); |
72 | let (output_sender, output_receiver) = unbounded::<O>(); | 71 | let (output_sender, output_receiver) = unbounded::<O>(); |
73 | ( | 72 | ( |
74 | (input_sender, output_receiver), | 73 | Worker { |
74 | inp: input_sender, | ||
75 | out: output_receiver, | ||
76 | }, | ||
75 | input_receiver, | 77 | input_receiver, |
76 | output_sender, | 78 | output_sender, |
77 | ) | 79 | ) |