いつも忘れるのでメモ
$ cygstart .いつも忘れるのでメモ
$ cygstart .$ ls -ltr | tail -n 3| using System; | |
| using CommandLine; | |
| namespace CommandLineArg | |
| { | |
| class Program | |
| { | |
| public class Options | |
| { | |
| // shortnameで短いオプション名。(-v)longnameで長いオプション名を指定できる。(--versioninfo) |
| """ | |
| asyncio のサンプルです。 | |
| asyncio.Queueを使った producer-consumer パターンのサンプル。 | |
| """ | |
| import asyncio | |
| import contextlib | |
| import itertools | |
| import random | |
| import asyncio | |
| async def factorial(id: int, number: int): | |
| f = 1 | |
| for i in range(2, number + 1): | |
| print(f'[{id}]: compute {i} ...') | |
| await asyncio.sleep(1) | |
| f *= i | |
| print(f'[{id}]: factorial {number} = {f}') |
| # ------------------------------------------------ | |
| # イベントループを別スレッドで動作させて | |
| # メインスレッドは生かすサンプル | |
| # | |
| # asyncio をつかった処理にて、別スレッドから | |
| # イベントスレッドに対して処理を行う場合 | |
| # イベントスレッド自体がスレッドセーフではないため | |
| # 専用のメソッドを利用する必要がある | |
| # | |
| # - ev_loop.call_soon_threadsafe() |
$ git fetch origin
$ git log HEAD..FETCH_HEAD
$ git diff HEAD..FETCH_HEAD
$ git merge FETCH_HEAD| /// <summary> | |
| /// REF: https://blogs.msdn.microsoft.com/pfxteam/2012/01/20/await-synchronizationcontext-and-console-apps/ | |
| /// REF: https://qiita.com/ousttrue/items/66def43267329bc132ff | |
| /// </summary> | |
| internal sealed class SingleThreadSynchronizationContext : SynchronizationContext | |
| { | |
| private readonly BlockingCollection<KeyValuePair<SendOrPostCallback, object>> _queue; | |
| public SingleThreadSynchronizationContext() | |
| { |
1に上げた参考情報の回答部分を引用と拙訳
This is not a property of WPF, it's a property of virtual memory.