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
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) |
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
class Transaction {} | |
class ServiceCharge : Transaction {} | |
class Sale : Transaction {} | |
interface IChargable<out T> where T : Transaction | |
{ | |
Transaction Charge(); | |
} | |
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
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"); |