Skip to content

Commit 4e3f8b2

Browse files
committed
添加protobuf的wiki
1 parent 29d95be commit 4e3f8b2

File tree

7 files changed

+64
-0
lines changed

7 files changed

+64
-0
lines changed

Diff for: Personal.md

+2
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,5 @@
4040
[c++问题](./personal/cpp)
4141
[折腾linux](./personal/linux)
4242
[数据库](./personal/DB)
43+
[csharp](./personal/csharp)
44+
[一些工具](./personal/tool)

Diff for: personal/csharp.md

+3
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
# c# 相关
2+
3+
- [SynchronizationContext](./csharp/SynchronizationContext.md)
4+
- [exploring the async/await state machine](./csharp/exploring_async.md)
File renamed without changes.

Diff for: personal/csharp/exploring_async.md

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Exploring the async/await State Machine
2+
learn about c# await pattern
3+
4+
## The Awaitable Pattern
5+
* When we await some operation, it first gets a chance to complete synchronously.
6+
* introduce IsComplete GetResult OnComplete
7+
* 主要的是await不是async,如果async的函数中没有await的关键字,那么这个函数的执行就是同步的
8+
* 异步其实就是回调
9+
10+
[ref](https://vkontech.com/exploring-the-async-await-state-machine-the-awaitable-pattern/)
11+
---------------------------------
12+
13+
## Main Workflow and State Transitions
14+
* 介绍了状态机的运行的流程
15+
* 可以看出状态机根据await划分了step,然后不停的movenext检查每一步的状态机状态,每一步awaiter是否IsComplete
16+
如果完成,则调用GetResult获取结果,没有完成调用ContinueWith
17+
18+
[ref](https://vkontech.com/exploring-the-async-await-state-machine-main-workflow-and-state-transitions/)
19+
[ref -> closures](https://vkontech.com/the-intuitive-guide-to-understanding-closures-in-c/)
20+
---------------------------------
21+
22+
## Conceptual Implementation
23+
* 通过实现的简单版状态机可以看出如果awaiter调用IsComplete没有完成,那么会调用OnComplete(MoveNext)也就是当任务完成时,会调用MoveNext即回调处理
24+
* 相同类型的result只会创建一个awaiter,re-use
25+
26+
[ref](https://vkontech.com/exploring-the-async-await-state-machine-conceptual-implementation/)
27+
28+
---------------------------------
29+
30+
## Concrete Implementation
31+
* live on the stack -> This means no work for the Garbage Collector and optimal memory footprint
32+
* However, the main idea of async programming is to pause, offload the current thread, and continue later (probably on some other thread).
33+
* boxing State Machine onto heap - > 因为要在之后继续调用呢,栈肯定没了,必须boxing到heap
34+
IAsyncStateMachine boxed = stateMachine; stateMachine本身是一个struct,但是这样复制就导致了boxing,boxed就在堆了,因为boxed是一个引用类型
35+
36+
[ref](https://vkontech.com/exploring-the-async-await-state-machine-concrete-implementation/)
37+
---------------------------------
38+
39+
## Synchronization Context
40+
* The default Synchronization Context implementation would just schedule your callback to the Thread Pool
41+
*
42+
43+
[ref](https://vkontech.com/exploring-the-async-await-state-machine-synchronization-context/)
44+
---------------------------------

Diff for: personal/tool.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# tool
2+
3+
4+
- [protobuf](./tool/protobuf.md)

Diff for: personal/tool/protobuf.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# protobuf
2+
3+
## protogen
4+
在生成cs文件的时候,package的名字大小写有问题
5+
比如package ET,导出之后是namespage Et
6+
加上+names=original即可
7+
protogen --csharp_out=. test.proto +names=original

Diff for: tools.md

+4
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,7 @@ figlet 一个文本转化的工具
3131
- 一个windows的桌面美化工具 [rainmeter](./tools/introduce/rainmeter.md)
3232
- tilling windows manager for windows [komorebi](./tools/introduce/komorebi.md)
3333
- 使用hyper V with majaro hyper V
34+
35+
## Tips
36+
tldr something
37+
curl cht.sh/python/random+string

0 commit comments

Comments
 (0)