This file contains 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.Diagnostics; | |
using System.Linq; | |
using System.Text; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace ConsoleApplication1 | |
{ |
This file contains 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
public class ConcurrentQueueMailbox : Mailbox | |
{ | |
private ConcurrentQueue<Envelope> userMessages = new ConcurrentQueue<Envelope>(); | |
private ConcurrentQueue<Envelope> systemMessages = new ConcurrentQueue<Envelope>(); | |
private WaitCallback run = null; | |
public ConcurrentQueueMailbox() | |
{ | |
run = new WaitCallback(_ => | |
{ |
This file contains 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
public class Mailbox | |
{ | |
private ConcurrentQueue<Envelope> queue = new ConcurrentQueue<Envelope>(); | |
private int scheduled = 0; | |
private volatile bool hasUnScheduledMessages = false; | |
private WaitCallback run; | |
public Mailbox () | |
{ |
This file contains 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
public class Mailbox | |
{ | |
private static class MailboxStatus | |
{ | |
public const int Idle = 0; | |
public const int Busy = 1; | |
} | |
private readonly ConcurrentQueue<Envelope> _queue = new ConcurrentQueue<Envelope>(); | |
private volatile bool _hasUnScheduledMessages; |
This file contains 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
public static class ThreadPoolGuardian | |
{ | |
private static readonly BlockingCollection<Guard> guards = new BlockingCollection<Guard>(); | |
public static void Queue(Action action) | |
{ | |
Action wrapper = () => | |
{ | |
var guard = new Guard | |
{ |
This file contains 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.Text; | |
namespace ConfigParser | |
{ | |
internal class Program | |
{ | |
private static void Main(string[] args) | |
{ |
This file contains 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 chatMessages = GetObservableOfChatMessages(); | |
var chatIsIdle = chatMessages. _dontknow_ (TimeSpan.FromSeconds(5)); | |
chatMessages.Subscribe (msg => Console.WriteLine("{0} says: {1}",msg.User,msg.Text)); | |
//I want this to occur every time the chatmessages observable have been silent for 5 sec | |
//not just once | |
chatIsIdle.Subscribe ( ... => Console.WriteLine("Chat is idle..."); |
This file contains 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
public class Foo<T> where T: IDoStuff | |
{ | |
private T _stuffer; | |
public Foo(T stuffer) | |
{ | |
_stuffer = stuffer; | |
} | |
public void Bar() |
This file contains 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.Diagnostics; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Reflection; | |
namespace ConsoleApplication10 | |
{ | |
internal delegate T ObjectActivator<out T>(params object[] args); |
This file contains 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.Tasks; | |
using Akka.Actor; | |
using Akka.TestKit; | |
using Xunit; | |
namespace Akka.Tests.Dispatch | |
{ | |
public class AsyncAwaitActor : ReceiveActor | |
{ |
OlderNewer