summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Simon Van Casteren <simon.van.casteren@gmail.com>2020-01-08 12:09:57 +0100
committerGravatar Simon Van Casteren <simon.van.casteren@gmail.com>2020-01-08 12:09:57 +0100
commit874e3bc001e64ba058d6632ebe22fbcdac16c00d (patch)
tree89bc423b3d51fd5f04b0696ee2b106b86497665b /src
parentcffbd03336348508dfb8d647a593c24b9bc89878 (diff)
Add bg_thread.dummy.sml to mock MLton threads in sml/nj
Diffstat (limited to 'src')
-rw-r--r--src/bg_thread.dummy.sml9
-rw-r--r--src/bg_thread.mlton.sml (renamed from src/bg_thread.sml)2
-rw-r--r--src/prefix.cm2
-rw-r--r--src/prefix.mlb3
-rw-r--r--src/sources4
5 files changed, 14 insertions, 6 deletions
diff --git a/src/bg_thread.dummy.sml b/src/bg_thread.dummy.sml
new file mode 100644
index 00000000..699fa741
--- /dev/null
+++ b/src/bg_thread.dummy.sml
@@ -0,0 +1,9 @@
+(*
+ Dummy implementation. Threading is only supported in MLton.
+ All other implementations just immediately run the background tasks
+*)
+structure BgThread:> BGTHREAD = struct
+ fun queueBgTask filename f = f ()
+ fun hasBgTasks () = false
+ fun runBgTaskForABit () = ()
+end
diff --git a/src/bg_thread.sml b/src/bg_thread.mlton.sml
index c5eb723c..91195940 100644
--- a/src/bg_thread.sml
+++ b/src/bg_thread.mlton.sml
@@ -6,8 +6,6 @@ structure BgThread:> BGTHREAD = struct
open MLton
open Itimer Signal Thread
- val debug = LspSpec.debug
-
val topLevel: Thread.Runnable.t option ref = ref NONE
val currentRunningThreadIsForFileName: string ref = ref ""
(* FIFO queue: Max one task per fileName *)
diff --git a/src/prefix.cm b/src/prefix.cm
index 2e71d073..eab0bf71 100644
--- a/src/prefix.cm
+++ b/src/prefix.cm
@@ -4,4 +4,6 @@ $/basis.cm
$/smlnj-lib.cm
$smlnj/ml-yacc/ml-yacc-lib.cm
$/pp-lib.cm
+$(SRC)/bg_thread.sig
+$(SRC)/bg_thread.dummy.sml
diff --git a/src/prefix.mlb b/src/prefix.mlb
index 6a510481..13122fcf 100644
--- a/src/prefix.mlb
+++ b/src/prefix.mlb
@@ -3,5 +3,8 @@ local
$(SML_LIB)/smlnj-lib/Util/smlnj-lib.mlb
$(SML_LIB)/mlyacc-lib/mlyacc-lib.mlb
$(SML_LIB)/smlnj-lib/PP/pp-lib.mlb
+ $(SML_LIB)/basis/mlton.mlb
+ $(SRC)/bg_thread.sig
+ $(SRC)/bg_thread.mlton.sml
in
diff --git a/src/sources b/src/sources
index 686832cc..74171365 100644
--- a/src/sources
+++ b/src/sources
@@ -285,10 +285,6 @@ $(SRC)/fromjson.sml
$(SRC)/lspspec.sml
-$(SML_LIB)/basis/mlton.mlb
-$(SRC)/bg_thread.sig
-$(SRC)/bg_thread.sml
-
$(SRC)/lsp.sig
$(SRC)/lsp.sml