简体   繁体   English

依次三个不同的线程

[英]Three different threads in sequence

I have three different threads; 我有三个不同的线程; to connect to http, login and download files from server. 连接到http,登录并从服务器下载文件。 Does anyone know how to put them together so that it will first go and connect, then login, later download files? 有谁知道如何将它们放在一起,以便它首先连接并登录,然后再下载文件?

I know i can use _connectionThread.start(); 我知道我可以使用_connectionThread.start(); in the constructor but it is not in order that i want. 在构造函数中,但它不是我想要的顺序。 How do i do that? 我怎么做?

Thank in advance. 预先感谢。

Each of three operations is dependent on the previous operation ie (connect <- login <- download). 三个操作中的每一个都取决于先前的操作,即(连接<-登录<-下载)。 Hence they have to be performed in series. 因此,它们必须顺序执行。 So there is no need to do each of them in separate thread. 因此,无需在单独的线程中执行每个操作。 As they are serial doing them in same thread will often give you better results. 由于它们是串行的,因此在同一线程中执行它们通常会为您带来更好的结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM