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

推荐订阅源

WordPress大学
WordPress大学
The GitHub Blog
The GitHub Blog
F
Fortinet All Blogs
Cloudbric
Cloudbric
P
Palo Alto Networks Blog
T
Threatpost
T
Tor Project blog
T
Tenable Blog
AWS News Blog
AWS News Blog
Project Zero
Project Zero
L
LangChain Blog
Cyberwarzone
Cyberwarzone
Engineering at Meta
Engineering at Meta
雷峰网
雷峰网
C
CERT Recently Published Vulnerability Notes
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Security Latest
Security Latest
云风的 BLOG
云风的 BLOG
I
Intezer
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Proofpoint News Feed
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News
V
Vulnerabilities – Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
MongoDB | Blog
MongoDB | Blog
aimingoo的专栏
aimingoo的专栏
K
Kaspersky official blog
Jina AI
Jina AI
N
News | PayPal Newsroom
T
The Blog of Author Tim Ferriss
D
DataBreaches.Net
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
Recorded Future
Recorded Future
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Secure Thoughts
TaoSecurity Blog
TaoSecurity Blog
P
Privacy & Cybersecurity Law Blog
P
Proofpoint News Feed
MyScale Blog
MyScale Blog
IT之家
IT之家
Forbes - Security
Forbes - Security
The Hacker News
The Hacker News
Last Week in AI
Last Week in AI
T
Threat Research - Cisco Blogs
Y
Y Combinator Blog

博客园 - 王鹏翊

引用:使用 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
上载事件触发!
上载完毕!