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