如何让睡眠成为第二个线程 [英] How to make sleep the second thread alone

查看:87
本文介绍了如何让睡眠成为第二个线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我需要阅读Zip文件,然后提取并重新定位.
由于这是一个大文件(2gb)操作,因此我正在使用三个线程.
一个用于阅读,另一个用于提取,另一个用于重定位.
无论如何,第二个线程是否要等待第一个线程完成操作.以及第一个线程将如何与第二个线程进行通信?




Reagrds
Froxy

Hi All

I need to Read the Zip file and Extract and Relocate.
Since this is a large file(2gb) operation, i am using three threads.
One for Reading and another for Extracting and another for Relocate.
Is there anyway for the second thread to wait until the first thread completes the operation. And the how first thread will communicate to second thread?




Reagrds
Froxy

推荐答案



我想这个有关多线程之间通信的链接将为您提供帮助.

.NET多线程和线程之间的通信 [ ^ ]
Hi,

I guess this link about communication between multi threads would help you.

.NET multi-threading and communication between threads[^]


他们为您创建了一个特殊的类;-),称为ReaderWriterLock
http://msdn.microsoft.com/en-us/library/system.threading. readerwriterlock.aspx [ ^ ]

祝您好运!
They created a special class, just for you ;-) called the ReaderWriterLock
http://msdn.microsoft.com/en-us/library/system.threading.readerwriterlock.aspx[^]

Good luck!


您可以使用dos命令
回声批处理控制器
呼叫C:\ Users \ Desktop \ test.bat
呼叫C:\ Users \ Desktop \ test2.bat
回显批处理控制器再次运行
退出
you can use the dos command
echo batch controller
call C:\Users\Desktop\test.bat
call C:\Users\Desktop\test2.bat
echo batch controller running again
exit


这篇关于如何让睡眠成为第二个线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆