Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fantomas
  • Loading branch information
auduchinok committed Oct 18, 2023
commit 303355689baafc07a45888bcbe214c5a0f5afdde
10 changes: 6 additions & 4 deletions src/Compiler/Utilities/Cancellable.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,20 @@ type Cancellable =
[<ThreadStatic; DefaultValue>]
static val mutable private tokens: CancellationToken list

static member private Tokens
with get () =
static member Tokens
with private get () =
match box Cancellable.tokens with
| Null -> []
| _ -> Cancellable.tokens
and set v = Cancellable.tokens <- v
and private set v = Cancellable.tokens <- v

static member UsingToken(ct) =
Cancellable.Tokens <- ct :: Cancellable.Tokens

{ new IDisposable with
member this.Dispose() =
Cancellable.Tokens <- Cancellable.Tokens |> List.tail }
Cancellable.Tokens <- Cancellable.Tokens |> List.tail
}

static member Token =
match Cancellable.Tokens with
Expand All @@ -36,6 +37,7 @@ type Cancellable =
[<AutoOpen>]
module Cancellable =
type Exception with

member this.IsOperationCancelled =
match this with
| :? OperationCanceledException -> true
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/Utilities/Cancellable.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ type Cancellable =
[<AutoOpen>]
module internal Cancellable =
type Exception with
member IsOperationCancelled: bool

member IsOperationCancelled: bool

namespace Internal.Utilities.Library

Expand Down