惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

阮一峰的网络日志
阮一峰的网络日志
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
Schneier on Security
The Last Watchdog
The Last Watchdog
Cyberwarzone
Cyberwarzone
S
Securelist
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Cyber Attacks, Cyber Crime and Cyber Security
L
Lohrmann on Cybersecurity
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 司徒正美
The Cloudflare Blog
V
V2EX
博客园_首页
博客园 - 聂微东
Vercel News
Vercel News
人人都是产品经理
人人都是产品经理
G
GRAHAM CLULEY
T
Tenable Blog
Last Week in AI
Last Week in AI
Y
Y Combinator Blog
L
LINUX DO - 最新话题
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
SecWiki News
SecWiki News
博客园 - 三生石上(FineUI控件)
S
Secure Thoughts
N
News | PayPal Newsroom
T
The Blog of Author Tim Ferriss
The GitHub Blog
The GitHub Blog
T
Troy Hunt's Blog
博客园 - 【当耐特】
Forbes - Security
Forbes - Security
H
Hacker News: Front Page
A
About on SuperTechFans
B
Blog RSS Feed
Engineering at Meta
Engineering at Meta
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
罗磊的独立博客
D
DataBreaches.Net
P
Privacy & Cybersecurity Law Blog
Schneier on Security
Schneier on Security
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Google DeepMind News
Google DeepMind News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Jina AI
Jina AI
D
Docker
P
Proofpoint News Feed

博客园 - 王鹏翊

引用:使用 IntelliTrace 调试应用程序 zz 数据库范式 SOA7阶段成熟度和路线图 zz:wikipedia中对Zachman_Framework的解释 zz:TOGAF和SOA 转:应用jBPM4解决中国特色的流程需求 Shell Extension的一些学习资源 转:Understanding Classic COM Interoperability With .NET Applications 架构框架TOGAF发布9.0版本 wikipedia中关于知识、本体的解释 转:知识管理概念综述(二) 转:知识管理概念综述(一) FW: 采用CAS原理构建单点登录 转:声明式的WCF安全模型 转:Infoworld发布2009年度开源软件大奖 彩色UML(color uml) 转:(C#)Windows Shell 外壳编程系列1 - 基础,浏览一个文件夹 转:Windows外壳名字空间的浏览 用例、用户故事和特性的区别
线程同步Demo:SynchronizationContext和EventWaitHandle:异步和同步
王鹏翊 · 2009-09-21 · via 博客园 - 王鹏翊

涉及到两个类:FileUpload和调用方。
1、FileUpload上传是时使用异步方式,但需要向调用方(另一线程)发布状态信息(例子里只有上传完毕状态,实际可以包括进度等状态),
    调用方不想处理多线程问题,于是考虑SynchronizationContext
2、例子里调用方需要等待上传线程完成,于是用了EventWaitHandle,好像是找麻烦了,呵呵

Code

结果:

开始调用上载
Upload.Begin...
异步上载立即返回
uploading 0...
uploading 1...
uploading 2...
uploading 3...
uploading 4...
DoUpload.Completed
上载事件触发!
上载完毕!