File tree Expand file tree Collapse file tree
tests/FSharp.Compiler.Service.Tests2 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,6 @@ let runCompiler () =
88
99[<EntryPoint>]
1010let main _ =
11- TestDepResolving.TestProject( @" C:\projekty\fsharp\heuristic\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj" )
12- // runCompiler ()
11+ // TestDepResolving.TestProject(@"C:\projekty\fsharp\heuristic\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj")
12+ runCompiler ()
1313 0
Original file line number Diff line number Diff line change 11module FSharp.Compiler.Service.Tests.RunCompiler
22
3+ open System.Collections .Concurrent
4+ open System.Threading
5+ open System.Threading .Tasks
36open NUnit.Framework
47
58[<Test>]
69let runCompiler () =
7- let args =
8- System.IO.File.ReadAllLines( @" C:\projekty\fsharp\heuristic\tests\FSharp.Compiler.Service.Tests2\args.txt" ) |> Array.skip 1
9- FSharp.Compiler.CommandLineMain.main args |> ignore
10+ // let args =
11+ // System.IO.File.ReadAllLines(@"C:\projekty\fsharp\heuristic\tests\FSharp.Compiler.Service.Tests2\args.txt") |> Array.skip 1
12+ // FSharp.Compiler.CommandLineMain.main args |> ignore
13+
14+ let go ( idx : int ) =
15+ printfn $" {idx} start"
16+ Thread.Sleep( 1000 )
17+ printfn $" {idx} stop"
18+
19+ printfn " start"
20+ use q = new BlockingCollection< int>()
21+ let work ( idx : int ) =
22+ printfn $" start worker {idx}"
23+ q.GetConsumingEnumerable()
24+ |> Seq.iter go
25+ printfn $" end worker {idx}"
26+ let maxParallel = 4
27+ printfn " workers"
28+ let workers =
29+ [| 1 .. maxParallel|]
30+ |> Array.map ( fun idx -> Task.Factory.StartNew( fun () -> work idx))
31+
32+ printfn " adding"
33+ for i in [| 1 .. 20 |] do
34+ q.Add( i)
35+ Thread.Sleep( 300 )
36+ printfn " CompleteAdding"
37+ q.CompleteAdding()
38+ printfn " waitall"
39+ Task.WaitAll workers
40+ printfn " End"
41+ ()
You can’t perform that action at this time.
0 commit comments