This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var queue = new ConcurrentQueue<string>(); | |
var bc = new BlockingCollection<string>(queue, 1); | |
bc.Add("first"); | |
string s; | |
queue.TryDequeue(out s); | |
bc.Add("blocking"); // blocks here even though internal queue is empty |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open FSharpx.Collections | |
let first = LazyList.ofSeq(seq { 0..3..30 } |> Seq.map (fun x -> (x, "first") )) | |
let second = LazyList.ofSeq(seq { 0..2..30 } |> Seq.map (fun x -> (x, "second"))) | |
let third = LazyList.ofSeq(seq { 0..30 } |> Seq.map (fun x -> (x, "third"))) | |
module LazyList = | |
let takeWhileAsList pred (list:LazyList<'T>) = | |
let rec inner l (r:List<'T>) = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let test name = | |
fun (msg : obj) -> | |
async { | |
printfn name }, id | |
let f, f2 = Ipc.test "hello" | |
//gives: | |
//error FS0001: This expression was expected to have type |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let dependencies (package : IPackage) = | |
match package.DependencySets with | |
| null -> [] | |
| sets -> | |
sets | |
|> filterNulls | |
|> Seq.map (fun d -> d.Dependencies) | |
|> filterNulls | |
|> Seq.concat | |
|> filterNulls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0:000> !gcroot -nostacks 02bc6fb8 | |
HandleTable: | |
00131120 (strong handle) | |
-> 02afd94c System.Threading._ThreadPoolWaitOrTimerCallback | |
-> 02afd904 System.Threading.WaitOrTimerCallback | |
-> 02afd8e0 <StartupCode$FSharp-Core>.$Control+AwaitWaitHandle@1548-2 | |
-> 027b1f3c Microsoft.FSharp.Control.AsyncParamsAux | |
-> 027b1f2c Microsoft.FSharp.Control.AsyncBuilderImpl+econt@807-3[[Microsoft.FSharp.Core.Unit, FSharp.Core]] | |
-> 027b1f20 <StartupCode$FSharp-Core>.$Control+p@2287-1[[System.Tuple`2[[System.Guid, mscorlib],[System.Object, mscorlib]], mscorlib]] | |
-> 027ba178 Microsoft.FSharp.Control.FSharpMailboxProcessor`1[[System.Tuple`2[[System.Guid, mscorlib],[System.Object, mscorlib]], mscorlib]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
warning FS0075: The command-line option '--version' has been deprecated | |
warning FS0075: The command-line option 'times' is for internal use only | |
TIME: 0.2 Delta: 0.0 Mem: 26 G0: 0 G1: 0 G2: 0 [Import mscorlib] | |
TIME: 0.2 Delta: 0.0 Mem: 26 G0: 0 G1: 0 G2: 0 [Import mscorlib and FSharp.Core.dll] | |
TIME: 0.4 Delta: 0.2 Mem: 57 G0: 6 G1: 1 G2: 1 [Import system references] | |
/home/karl/fsharp/src/fsharp/FSharp.Build-proto/.libs/proto/FSBuild.fs(17,5): error FS0193: internal error: Object reference not set to an instance of an object | |
/home/karl/fsharp/src/utils/CompilerLocationUtils.fs(9,9): error FS0193: internal error: Object reference not set to an instance of an object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System | |
open System.Collections.Concurrent | |
type DedupeProtocol<'T> = | |
| Add of 'T | |
| Remove of 'T | |
type DedupingAgent<'T when 'T : comparison>(handle : 'T -> unit) = | |
let queue = new BlockingCollection<'T>() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type TimingHandler() = | |
inherit DelegatingHandler () | |
let cont (sw : Stopwatch) (t: Task<HttpResponseMessage>) = | |
sw.Stop() | |
debug "request time: %i" sw.ElapsedMilliseconds | |
t.Result // dont like this | |
override this.SendAsync (request, token) = | |
let sw = new Stopwatch() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Found 1 unique roots (run '!GCRoot -all' to see all roots). | |
0:000> !gcroot 161f97f0 | |
HandleTable: | |
044f4788 (strong handle) | |
-> 161f9b64 System.Threading._ThreadPoolWaitOrTimerCallback | |
-> 161f9b1c System.Threading.WaitOrTimerCallback | |
-> 161f9af8 <StartupCode$FSharp-Core>.$Control+AwaitWaitHandle@1624-2 | |
-> 161f9a80 Microsoft.FSharp.Control.AsyncBuilderImpl+args@797-1[[System.Boolean, mscorlib],[Microsoft.FSharp.Core.FSharpOption`1[[Riemann.Proto.Event, Riemann]], FSharp.Core]] | |
-> 161f9a60 Microsoft.FSharp.Control.AsyncParams`1[[Microsoft.FSharp.Core.FSharpOption`1[[Riemann.Proto.Event, Riemann]], FSharp.Core]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type IdGenerator () = | |
let agent = MailboxProcessor<AsyncReplyChannel<int>>.Start(fun inbox -> | |
let rec loop c = async { | |
let! rc = inbox.Receive () | |
rc.Reply (c + 1) | |
return! loop (c + 1) } | |
loop 0) | |
member this.Next () = | |
agent.PostAndReply(fun rc -> rc) |
OlderNewer