aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock84
-rw-r--r--crates/thread_worker/Cargo.toml2
-rw-r--r--crates/thread_worker/src/lib.rs39
3 files changed, 52 insertions, 73 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 4ad9a01b0..f28d11732 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -35,12 +35,12 @@ dependencies = [
35 35
36[[package]] 36[[package]]
37name = "autocfg" 37name = "autocfg"
38version = "0.1.5" 38version = "0.1.6"
39source = "registry+https://github.com/rust-lang/crates.io-index" 39source = "registry+https://github.com/rust-lang/crates.io-index"
40 40
41[[package]] 41[[package]]
42name = "backtrace" 42name = "backtrace"
43version = "0.3.34" 43version = "0.3.35"
44source = "registry+https://github.com/rust-lang/crates.io-index" 44source = "registry+https://github.com/rust-lang/crates.io-index"
45dependencies = [ 45dependencies = [
46 "backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", 46 "backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -198,7 +198,7 @@ dependencies = [
198 "chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git)", 198 "chalk-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git)",
199 "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git)", 199 "chalk-macros 0.1.1 (git+https://github.com/rust-lang/chalk.git)",
200 "chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git)", 200 "chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git)",
201 "derive-new 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)", 201 "derive-new 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
202 "ena 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", 202 "ena 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
203 "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 203 "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
204 "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", 204 "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -233,7 +233,7 @@ dependencies = [
233 "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 233 "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
234 "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", 234 "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
235 "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", 235 "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
236 "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 236 "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
237 "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", 237 "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
238] 238]
239 239
@@ -269,7 +269,7 @@ dependencies = [
269 "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", 269 "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
270 "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 270 "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
271 "termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 271 "termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
272 "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 272 "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
273 "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", 273 "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
274] 274]
275 275
@@ -344,12 +344,12 @@ dependencies = [
344 344
345[[package]] 345[[package]]
346name = "derive-new" 346name = "derive-new"
347version = "0.5.7" 347version = "0.5.8"
348source = "registry+https://github.com/rust-lang/crates.io-index" 348source = "registry+https://github.com/rust-lang/crates.io-index"
349dependencies = [ 349dependencies = [
350 "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", 350 "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
351 "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", 351 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
352 "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", 352 "syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
353] 353]
354 354
355[[package]] 355[[package]]
@@ -406,7 +406,7 @@ name = "failure"
406version = "0.1.5" 406version = "0.1.5"
407source = "registry+https://github.com/rust-lang/crates.io-index" 407source = "registry+https://github.com/rust-lang/crates.io-index"
408dependencies = [ 408dependencies = [
409 "backtrace 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)", 409 "backtrace 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)",
410 "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 410 "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
411] 411]
412 412
@@ -579,7 +579,7 @@ dependencies = [
579 579
580[[package]] 580[[package]]
581name = "indexmap" 581name = "indexmap"
582version = "1.0.2" 582version = "1.1.0"
583source = "registry+https://github.com/rust-lang/crates.io-index" 583source = "registry+https://github.com/rust-lang/crates.io-index"
584 584
585[[package]] 585[[package]]
@@ -684,6 +684,11 @@ dependencies = [
684] 684]
685 685
686[[package]] 686[[package]]
687name = "jod-thread"
688version = "0.1.0"
689source = "registry+https://github.com/rust-lang/crates.io-index"
690
691[[package]]
687name = "join_to_string" 692name = "join_to_string"
688version = "0.1.3" 693version = "0.1.3"
689source = "registry+https://github.com/rust-lang/crates.io-index" 694source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -850,7 +855,7 @@ name = "num-integer"
850version = "0.1.41" 855version = "0.1.41"
851source = "registry+https://github.com/rust-lang/crates.io-index" 856source = "registry+https://github.com/rust-lang/crates.io-index"
852dependencies = [ 857dependencies = [
853 "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 858 "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
854 "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 859 "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
855] 860]
856 861
@@ -859,7 +864,7 @@ name = "num-traits"
859version = "0.2.8" 864version = "0.2.8"
860source = "registry+https://github.com/rust-lang/crates.io-index" 865source = "registry+https://github.com/rust-lang/crates.io-index"
861dependencies = [ 866dependencies = [
862 "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 867 "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
863] 868]
864 869
865[[package]] 870[[package]]
@@ -937,7 +942,7 @@ dependencies = [
937 "proc-macro-hack 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", 942 "proc-macro-hack 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
938 "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 943 "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
939 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 944 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
940 "syn 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 945 "syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
941] 946]
942 947
943[[package]] 948[[package]]
@@ -1005,7 +1010,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1005dependencies = [ 1010dependencies = [
1006 "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 1011 "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
1007 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 1012 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
1008 "syn 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 1013 "syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
1009] 1014]
1010 1015
1011[[package]] 1016[[package]]
@@ -1092,7 +1097,7 @@ dependencies = [
1092 "ra_hir 0.1.0", 1097 "ra_hir 0.1.0",
1093 "ra_ide_api 0.1.0", 1098 "ra_ide_api 0.1.0",
1094 "ra_project_model 0.1.0", 1099 "ra_project_model 0.1.0",
1095 "ra_vfs 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", 1100 "ra_vfs 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
1096 "ra_vfs_glob 0.1.0", 1101 "ra_vfs_glob 0.1.0",
1097 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 1102 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
1098] 1103]
@@ -1198,7 +1203,7 @@ dependencies = [
1198 "ra_project_model 0.1.0", 1203 "ra_project_model 0.1.0",
1199 "ra_syntax 0.1.0", 1204 "ra_syntax 0.1.0",
1200 "ra_text_edit 0.1.0", 1205 "ra_text_edit 0.1.0",
1201 "ra_vfs 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", 1206 "ra_vfs 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
1202 "ra_vfs_glob 0.1.0", 1207 "ra_vfs_glob 0.1.0",
1203 "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 1208 "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
1204 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 1209 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1234,7 +1239,7 @@ dependencies = [
1234name = "ra_prof" 1239name = "ra_prof"
1235version = "0.1.0" 1240version = "0.1.0"
1236dependencies = [ 1241dependencies = [
1237 "backtrace 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)", 1242 "backtrace 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)",
1238 "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", 1243 "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
1239 "jemalloc-ctl 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 1244 "jemalloc-ctl 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
1240 "jemallocator 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", 1245 "jemallocator 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1307,10 +1312,11 @@ dependencies = [
1307 1312
1308[[package]] 1313[[package]]
1309name = "ra_vfs" 1314name = "ra_vfs"
1310version = "0.2.7" 1315version = "0.2.8"
1311source = "registry+https://github.com/rust-lang/crates.io-index" 1316source = "registry+https://github.com/rust-lang/crates.io-index"
1312dependencies = [ 1317dependencies = [
1313 "crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", 1318 "crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
1319 "jod-thread 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
1314 "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 1320 "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
1315 "notify 4.0.12 (registry+https://github.com/rust-lang/crates.io-index)", 1321 "notify 4.0.12 (registry+https://github.com/rust-lang/crates.io-index)",
1316 "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", 1322 "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1324,7 +1330,7 @@ name = "ra_vfs_glob"
1324version = "0.1.0" 1330version = "0.1.0"
1325dependencies = [ 1331dependencies = [
1326 "globset 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", 1332 "globset 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
1327 "ra_vfs 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", 1333 "ra_vfs 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
1328] 1334]
1329 1335
1330[[package]] 1336[[package]]
@@ -1332,7 +1338,7 @@ name = "rand"
1332version = "0.6.5" 1338version = "0.6.5"
1333source = "registry+https://github.com/rust-lang/crates.io-index" 1339source = "registry+https://github.com/rust-lang/crates.io-index"
1334dependencies = [ 1340dependencies = [
1335 "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 1341 "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
1336 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", 1342 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
1337 "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 1343 "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
1338 "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 1344 "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1363,7 +1369,7 @@ name = "rand_chacha"
1363version = "0.1.1" 1369version = "0.1.1"
1364source = "registry+https://github.com/rust-lang/crates.io-index" 1370source = "registry+https://github.com/rust-lang/crates.io-index"
1365dependencies = [ 1371dependencies = [
1366 "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 1372 "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
1367 "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 1373 "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
1368] 1374]
1369 1375
@@ -1449,7 +1455,7 @@ name = "rand_pcg"
1449version = "0.1.2" 1455version = "0.1.2"
1450source = "registry+https://github.com/rust-lang/crates.io-index" 1456source = "registry+https://github.com/rust-lang/crates.io-index"
1451dependencies = [ 1457dependencies = [
1452 "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 1458 "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
1453 "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 1459 "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
1454] 1460]
1455 1461
@@ -1458,7 +1464,7 @@ name = "rand_pcg"
1458version = "0.2.0" 1464version = "0.2.0"
1459source = "registry+https://github.com/rust-lang/crates.io-index" 1465source = "registry+https://github.com/rust-lang/crates.io-index"
1460dependencies = [ 1466dependencies = [
1461 "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 1467 "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
1462 "rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", 1468 "rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
1463] 1469]
1464 1470
@@ -1596,8 +1602,8 @@ version = "0.13.0"
1596source = "registry+https://github.com/rust-lang/crates.io-index" 1602source = "registry+https://github.com/rust-lang/crates.io-index"
1597dependencies = [ 1603dependencies = [
1598 "crossbeam 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", 1604 "crossbeam 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
1599 "derive-new 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)", 1605 "derive-new 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
1600 "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 1606 "indexmap 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
1601 "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 1607 "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
1602 "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", 1608 "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
1603 "rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", 1609 "rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1659,7 +1665,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1659dependencies = [ 1665dependencies = [
1660 "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 1666 "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
1661 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 1667 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
1662 "syn 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 1668 "syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
1663] 1669]
1664 1670
1665[[package]] 1671[[package]]
@@ -1679,7 +1685,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1679dependencies = [ 1685dependencies = [
1680 "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 1686 "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
1681 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 1687 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
1682 "syn 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 1688 "syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
1683] 1689]
1684 1690
1685[[package]] 1691[[package]]
@@ -1755,7 +1761,7 @@ dependencies = [
1755 1761
1756[[package]] 1762[[package]]
1757name = "syn" 1763name = "syn"
1758version = "1.0.2" 1764version = "1.0.3"
1759source = "registry+https://github.com/rust-lang/crates.io-index" 1765source = "registry+https://github.com/rust-lang/crates.io-index"
1760dependencies = [ 1766dependencies = [
1761 "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 1767 "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1814,7 +1820,7 @@ name = "textwrap"
1814version = "0.11.0" 1820version = "0.11.0"
1815source = "registry+https://github.com/rust-lang/crates.io-index" 1821source = "registry+https://github.com/rust-lang/crates.io-index"
1816dependencies = [ 1822dependencies = [
1817 "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 1823 "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
1818] 1824]
1819 1825
1820[[package]] 1826[[package]]
@@ -1830,6 +1836,7 @@ name = "thread_worker"
1830version = "0.1.0" 1836version = "0.1.0"
1831dependencies = [ 1837dependencies = [
1832 "crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", 1838 "crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
1839 "jod-thread 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
1833 "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 1840 "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
1834] 1841]
1835 1842
@@ -1892,7 +1899,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1892 1899
1893[[package]] 1900[[package]]
1894name = "unicode-width" 1901name = "unicode-width"
1895version = "0.1.5" 1902version = "0.1.6"
1896source = "registry+https://github.com/rust-lang/crates.io-index" 1903source = "registry+https://github.com/rust-lang/crates.io-index"
1897 1904
1898[[package]] 1905[[package]]
@@ -2014,8 +2021,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
2014"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" 2021"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
2015"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba" 2022"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba"
2016"checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" 2023"checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90"
2017"checksum autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "22130e92352b948e7e82a49cdb0aa94f2211761117f29e052dd397c1ac33542b" 2024"checksum autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875"
2018"checksum backtrace 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)" = "b5164d292487f037ece34ec0de2fcede2faa162f085dd96d2385ab81b12765ba" 2025"checksum backtrace 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)" = "1371048253fa3bac6704bfd6bbfc922ee9bdcee8881330d40f308b81cc5adc55"
2019"checksum backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "82a830b4ef2d1124a711c71d263c5abdc710ef8e907bd508c88be475cebc422b" 2026"checksum backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "82a830b4ef2d1124a711c71d263c5abdc710ef8e907bd508c88be475cebc422b"
2020"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" 2027"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e"
2021"checksum bit-set 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e84c238982c4b1e1ee668d136c510c67a13465279c0cb367ea6baf6310620a80" 2028"checksum bit-set 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e84c238982c4b1e1ee668d136c510c67a13465279c0cb367ea6baf6310620a80"
@@ -2048,7 +2055,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
2048"checksum crossbeam-epoch 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fedcd6772e37f3da2a9af9bf12ebe046c0dfe657992377b4df982a2b54cd37a9" 2055"checksum crossbeam-epoch 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fedcd6772e37f3da2a9af9bf12ebe046c0dfe657992377b4df982a2b54cd37a9"
2049"checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b" 2056"checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b"
2050"checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6" 2057"checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6"
2051"checksum derive-new 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c3fd04571b29c91cfbe1e7c9a228e069ac8635f180ffb4ccd6a6907617ee8bb0" 2058"checksum derive-new 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)" = "71f31892cd5c62e414316f2963c5689242c43d8e7bbcaaeca97e5e28c95d91d9"
2052"checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" 2059"checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
2053"checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" 2060"checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5"
2054"checksum drop_bomb 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "69b26e475fd29098530e709294e94e661974c851aed42512793f120fed4e199f" 2061"checksum drop_bomb 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "69b26e475fd29098530e709294e94e661974c851aed42512793f120fed4e199f"
@@ -2078,7 +2085,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
2078"checksum globset 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "925aa2cac82d8834e2b2a4415b6f6879757fb5c0928fc445ae76461a12eed8f2" 2085"checksum globset 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "925aa2cac82d8834e2b2a4415b6f6879757fb5c0928fc445ae76461a12eed8f2"
2079"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" 2086"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
2080"checksum idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" 2087"checksum idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9"
2081"checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d" 2088"checksum indexmap 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a4d6d89e0948bf10c08b9ecc8ac5b83f07f857ebe2c0cbe38de15b4e4f510356"
2082"checksum indicatif 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2c60da1c9abea75996b70a931bba6c750730399005b61ccd853cee50ef3d0d0c" 2089"checksum indicatif 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2c60da1c9abea75996b70a931bba6c750730399005b61ccd853cee50ef3d0d0c"
2083"checksum inotify 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40b54539f3910d6f84fbf9a643efd6e3aa6e4f001426c0329576128255994718" 2090"checksum inotify 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40b54539f3910d6f84fbf9a643efd6e3aa6e4f001426c0329576128255994718"
2084"checksum inotify-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e74a1aa87c59aeff6ef2cc2fa62d41bc43f54952f55652656b18a02fd5e356c0" 2091"checksum inotify-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e74a1aa87c59aeff6ef2cc2fa62d41bc43f54952f55652656b18a02fd5e356c0"
@@ -2089,6 +2096,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
2089"checksum jemalloc-ctl 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c502a5ff9dd2924f1ed32ba96e3b65735d837b4bfd978d3161b1702e66aca4b7" 2096"checksum jemalloc-ctl 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c502a5ff9dd2924f1ed32ba96e3b65735d837b4bfd978d3161b1702e66aca4b7"
2090"checksum jemalloc-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0d3b9f3f5c9b31aa0f5ed3260385ac205db665baa41d49bb8338008ae94ede45" 2097"checksum jemalloc-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0d3b9f3f5c9b31aa0f5ed3260385ac205db665baa41d49bb8338008ae94ede45"
2091"checksum jemallocator 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "43ae63fcfc45e99ab3d1b29a46782ad679e98436c3169d15a167a1108a724b69" 2098"checksum jemallocator 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "43ae63fcfc45e99ab3d1b29a46782ad679e98436c3169d15a167a1108a724b69"
2099"checksum jod-thread 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2f52a11f73b88fab829a0e4d9e13ea5982c7ac457c72eb3541d82a4afdfce4ff"
2092"checksum join_to_string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4dc7a5290e8c2606ce2be49f456d50f69173cb96d1541e4f66e34ac8b331a98f" 2100"checksum join_to_string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4dc7a5290e8c2606ce2be49f456d50f69173cb96d1541e4f66e34ac8b331a98f"
2093"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" 2101"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
2094"checksum lalrpop-intern 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cc4fd87be4a815fd373e02773983940f0d75fb26fde8c098e9e45f7af03154c0" 2102"checksum lalrpop-intern 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cc4fd87be4a815fd373e02773983940f0d75fb26fde8c098e9e45f7af03154c0"
@@ -2135,7 +2143,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
2135"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" 2143"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
2136"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" 2144"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
2137"checksum ra_rustc_lexer 0.1.0-pre.3 (registry+https://github.com/rust-lang/crates.io-index)" = "04371af481820ff8d35c7d12b503eb09cf9e1bd246269bf4a33e3d8c54fa3a4a" 2145"checksum ra_rustc_lexer 0.1.0-pre.3 (registry+https://github.com/rust-lang/crates.io-index)" = "04371af481820ff8d35c7d12b503eb09cf9e1bd246269bf4a33e3d8c54fa3a4a"
2138"checksum ra_vfs 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6918c38f6ab45101f1ddd6110eda831a735b5e9ca6c96d1ceedb7d13ecaeb0f4" 2146"checksum ra_vfs 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9e891866e1bb03f50a28cc01e3f244a62107c301ae674ba06b2e7a9b310ae75a"
2139"checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" 2147"checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca"
2140"checksum rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d47eab0e83d9693d40f825f86948aa16eff6750ead4bdffc4ab95b8b3a7f052c" 2148"checksum rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d47eab0e83d9693d40f825f86948aa16eff6750ead4bdffc4ab95b8b3a7f052c"
2141"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" 2149"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef"
@@ -2185,7 +2193,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
2185"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" 2193"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
2186"checksum superslice 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ab16ced94dbd8a46c82fd81e3ed9a8727dac2977ea869d217bcc4ea1f122e81f" 2194"checksum superslice 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ab16ced94dbd8a46c82fd81e3ed9a8727dac2977ea869d217bcc4ea1f122e81f"
2187"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" 2195"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5"
2188"checksum syn 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2ae5cd13590144ea968ba5d5520da7a4c08415861014399b5b349f74591c375f" 2196"checksum syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "158521e6f544e7e3dcfc370ac180794aa38cb34a1b1e07609376d4adcf429b93"
2189"checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" 2197"checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f"
2190"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" 2198"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
2191"checksum termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "72b620c5ea021d75a735c943269bb07d30c9b77d6ac6b236bc8b5c496ef05625" 2199"checksum termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "72b620c5ea021d75a735c943269bb07d30c9b77d6ac6b236bc8b5c496ef05625"
@@ -2200,7 +2208,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
2200"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" 2208"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
2201"checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426" 2209"checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426"
2202"checksum unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1967f4cdfc355b37fd76d2a954fb2ed3871034eb4f26d60537d88795cfc332a9" 2210"checksum unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1967f4cdfc355b37fd76d2a954fb2ed3871034eb4f26d60537d88795cfc332a9"
2203"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" 2211"checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20"
2204"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" 2212"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
2205"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" 2213"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
2206"checksum url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "75b414f6c464c879d7f9babf951f23bc3743fb7313c081b2e6ca719067ea9d61" 2214"checksum url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "75b414f6c464c879d7f9babf951f23bc3743fb7313c081b2e6ca719067ea9d61"
diff --git a/crates/thread_worker/Cargo.toml b/crates/thread_worker/Cargo.toml
index a9857d59d..e3babbf8d 100644
--- a/crates/thread_worker/Cargo.toml
+++ b/crates/thread_worker/Cargo.toml
@@ -5,6 +5,6 @@ version = "0.1.0"
5authors = ["rust-analyzer developers"] 5authors = ["rust-analyzer developers"]
6 6
7[dependencies] 7[dependencies]
8jod-thread = "0.1.0"
8crossbeam-channel = "0.3.5" 9crossbeam-channel = "0.3.5"
9log = "0.4.3" 10log = "0.4.3"
10
diff --git a/crates/thread_worker/src/lib.rs b/crates/thread_worker/src/lib.rs
index d8d0d9bf2..68e5c124d 100644
--- a/crates/thread_worker/src/lib.rs
+++ b/crates/thread_worker/src/lib.rs
@@ -1,39 +1,7 @@
1//! Small utility to correctly spawn crossbeam-channel based worker threads. 1//! Small utility to correctly spawn crossbeam-channel based worker threads.
2 2
3use std::thread;
4
5use crossbeam_channel::{bounded, unbounded, Receiver, Sender}; 3use crossbeam_channel::{bounded, unbounded, Receiver, Sender};
6 4
7/// Like `std::thread::JoinHandle<()>`, but joins thread in drop automatically.
8pub struct ScopedThread {
9 // Option for drop
10 inner: Option<thread::JoinHandle<()>>,
11}
12
13impl Drop for ScopedThread {
14 fn drop(&mut self) {
15 let inner = self.inner.take().unwrap();
16 let name = inner.thread().name().unwrap().to_string();
17 log::info!("waiting for {} to finish...", name);
18 let res = inner.join();
19 log::info!(".. {} terminated with {}", name, if res.is_ok() { "ok" } else { "err" });
20
21 // escalate panic, but avoid aborting the process
22 if let Err(e) = res {
23 if !thread::panicking() {
24 panic!(e)
25 }
26 }
27 }
28}
29
30impl ScopedThread {
31 pub fn spawn(name: &'static str, f: impl FnOnce() + Send + 'static) -> ScopedThread {
32 let inner = thread::Builder::new().name(name.into()).spawn(f).unwrap();
33 ScopedThread { inner: Some(inner) }
34 }
35}
36
37/// A wrapper around event-processing thread with automatic shutdown semantics. 5/// A wrapper around event-processing thread with automatic shutdown semantics.
38pub struct Worker<I, O> { 6pub struct Worker<I, O> {
39 // XXX: field order is significant here. 7 // XXX: field order is significant here.
@@ -48,7 +16,7 @@ pub struct Worker<I, O> {
48 // single client, so, if we are shutting down, nobody is interested in the 16 // single client, so, if we are shutting down, nobody is interested in the
49 // unfinished work anyway! 17 // unfinished work anyway!
50 sender: Sender<I>, 18 sender: Sender<I>,
51 _thread: ScopedThread, 19 _thread: jod_thread::JoinHandle<()>,
52 receiver: Receiver<O>, 20 receiver: Receiver<O>,
53} 21}
54 22
@@ -63,7 +31,10 @@ impl<I, O> Worker<I, O> {
63 // and output buffers to a fixed size, a worker might get stuck. 31 // and output buffers to a fixed size, a worker might get stuck.
64 let (sender, input_receiver) = bounded::<I>(buf); 32 let (sender, input_receiver) = bounded::<I>(buf);
65 let (output_sender, receiver) = unbounded::<O>(); 33 let (output_sender, receiver) = unbounded::<O>();
66 let _thread = ScopedThread::spawn(name, move || f(input_receiver, output_sender)); 34 let _thread = jod_thread::Builder::new()
35 .name(name.to_string())
36 .spawn(move || f(input_receiver, output_sender))
37 .expect("failed to spawn a thread");
67 Worker { sender, _thread, receiver } 38 Worker { sender, _thread, receiver }
68 } 39 }
69} 40}