Skip to content

Instantly share code, notes, and snippets.

import trio
from typing import AsyncIterator, Awaitable, Callable, Coroutine, Optional, TypeVar
A = TypeVar("A")
B = TypeVar("B")
async def yield_with_delay(val, delay):
for i in range(5):
await trio.sleep(delay)
class Transaction {}
class ServiceCharge : Transaction {}
class Sale : Transaction {}
interface IChargable<out T> where T : Transaction
{
Transaction Charge();
}
@jhominal
jhominal / Program.cs
Created August 1, 2012 09:58
SetSynchronizationContext on the main thread does not set the context for background threads
class Program
{
static void Main(string[] args)
{
Console.Out.WriteLine("Main Thread ID: {0}", Thread.CurrentThread.ManagedThreadId);
PrintCurrentSyncContext();
DoOpInBgThread();
Console.Out.WriteLine("Set SyncContext to new");