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
| void Main() | |
| { | |
| } | |
| public static class ChannelOpDsl | |
| { | |
| public static ChannelCommandQueue<TCommand> BeginCommandQueue<TCommand>(int bufferSize, bool multiWrite) | |
| { | |
| return new ChannelCommandQueue<TCommand>(bufferSize,multiWrite); |
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
| <Query Kind="Program"> | |
| <NuGetReference>LanguageExt.Core</NuGetReference> | |
| <NuGetReference>System.Threading.Channels</NuGetReference> | |
| <NuGetReference>ValueTaskSupplement</NuGetReference> | |
| <Namespace>LanguageExt</Namespace> | |
| <Namespace>System.Collections.Concurrent</Namespace> | |
| <Namespace>System.Diagnostics.CodeAnalysis</Namespace> | |
| <Namespace>System.Threading.Channels</Namespace> | |
| <Namespace>System.Threading.Tasks</Namespace> | |
| <Namespace>ValueTaskSupplement</Namespace> |
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
| using System; | |
| using System.Collections.Generic; | |
| using System.Runtime.CompilerServices; | |
| using System.Threading; | |
| using System.Threading.Channels; | |
| using System.Threading.Tasks; | |
| //This probably mostly works. [1] | |
| //Basically an adaptation of akka.persistence.linq2db's stream setup | |
| //To use channels instead. :D |
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
| async Task Main() | |
| { | |
| var tcs = new TaskCompletionSource(); | |
| var t = new Thread(async () => | |
| { | |
| try | |
| { | |
| for (int i = 0; i < 2; i++) | |
| { | |
| Thread.CurrentThread.IsThreadPoolThread.Dump(); |
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
| using System; | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using System.Runtime.CompilerServices; | |
| namespace GlutenFree.Collectons | |
| { | |
| public class UnrolledLinkedList<T> : IList<T> | |
| { | |
| private readonly int nodeCapacity = Node.NodeSize; |
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
| using System.Collections.Concurrent; | |
| using System.Threading.Channels; | |
| var channel = Channel.CreateUnbounded<int>(); | |
| var syncContext = new SingleThreadedSyncContext(); | |
| syncContext.Post(async _ => | |
| { | |
| await foreach (var item in channel.Reader.ReadAllAsync()) |
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
| <Query Kind="Program"> | |
| <Namespace>System.Threading.Channels</Namespace> | |
| <Namespace>System.Threading.Tasks</Namespace> | |
| </Query> | |
| async Task Main() | |
| { | |
| var channel = Channel.CreateBounded<string>(100); | |
| Func<CancellationTokenSource> newCts = ()=> new CancellationTokenSource(); |
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
| using System; | |
| using System.Threading; | |
| using System.Threading.Channels; | |
| using System.Threading.Tasks; | |
| namespace GlutenFree.Synchronizaton | |
| { | |
| public class WaitOrCompletionLock | |
| { | |
| private readonly Channel<int> lockChannel = Channel.CreateBounded<int>(1); |
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
| //USE AT OWN RISK, PORTED UNTESTED CODE | |
| /// <devremarks> | |
| /// vaguely based on | |
| /// https://github.com/l-tamas/Unrolled-linked-list/blob/master/src/org/megatherion/util/collections/UnrolledLinkedList.java | |
| /// </devremarks> | |
| public class UnrolledLinkedList<T> //: IList<T> | |
| : IEnumerable<T> | |
| { | |
| private readonly int nodeCapacity = Node.NodeSize; |
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
| <Query Kind="Program"> | |
| <NuGetReference>linq2db</NuGetReference> | |
| <NuGetReference>Microsoft.Data.Sqlite.Core</NuGetReference> | |
| <NuGetReference>SQLitePCLRaw.bundle_e_sqlite3</NuGetReference> | |
| <Namespace>LinqToDB</Namespace> | |
| <Namespace>LinqToDB.Data</Namespace> | |
| <Namespace>LinqToDB.Mapping</Namespace> | |
| <Namespace>Microsoft.Data.Sqlite</Namespace> | |
| <UseNoncollectibleLoadContext>true</UseNoncollectibleLoadContext> | |
| <CopyLocal>true</CopyLocal> |