Skip to content

Commit 082cfde

Browse files
committed
TerminateTransactions
1 parent 34eb9c2 commit 082cfde

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

Kernel/Evaluator.wl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ BeginPackage["CoffeeLiqueur`Notebook`Evaluator`", {"KirillBelov`Objects`", "Jerr
22

33
StandardEvaluator::usage = "StandardEvaluator[opts__] creates a basic Evaluator"
44
EvaluateTransaction;
5+
TerminateTransactions;
56

67
ReadyQ;
78
Container::usage = "a static construction used for combinning StaticEvaluators and Kernels"
@@ -42,6 +43,18 @@ InitializedContainer[k_(*Kernel*)][t_Transaction] := Module[{evaluator, state},
4243
t
4344
]
4445

46+
InitializedContainer[k_(*Kernel*)][$Aborted] := Module[{diposableToken},
47+
Print["Termination Eval"];
48+
diposableToken = Function[Null,
49+
Echo["Aborting Kernel"];
50+
If[k["State"] === "Initialized", GenericKernel`AbortEvaluation[k] ];
51+
diposableToken = Null;
52+
];
53+
54+
TerminateTransactions[#, diposableToken] &/@ Flatten[eList];
55+
ClearAll[diposableToken];
56+
]
57+
4558
StandardEvaluator /: ReadyQ[StandardEvaluator[o_(*Kernel*)] ] := True
4659

4760
StandardEvaluator /: Print[evaluator_StandardEvaluator, msg_] := Echo[evaluator["Name"] <> " >> " <> ToString[msg] ]

Views/Notebook/Notebook.wlx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ Component[OptionsPattern[]] := With[{
727727
Return[];
728728
];
729729

730-
If[notebook["Evaluator"]["Kernel"]["State"] === "Initialized", GenericKernel`AbortEvaluation[notebook["Evaluator"]["Kernel"]] (*`*) ];
730+
notebook["Evaluator"][$Aborted];
731731
Map[Function[cell,
732732
cell["State"] = "Idle";
733733
EventFire[cell, "State", "Idle"];

0 commit comments

Comments
 (0)