Ask for multi-threaded multitasking!

zhaozj2021-02-16  93

Consult on multithreaded multitasking Author:! Coldsea_2000 (Zhang) Grade: credit value: 100 Quantity forum: VC / MFC process / thread / DLL problem Points: 100 Replies: 7 Time: 2002-05-2314: 57: 15Z

Dear brother: The younger brother wanted to be a download software similar to the online ants today. I implemented multi-thread, but how many tasks don't know how to implement? I think is it in the order of the task? To create a thread for the task itself --- is also a thread in the thread? If it is a thread in the thread, how can I do and manage multi-thread? Thank you, don't worry!

Reply to: kevin_qing () () Reputation: 103 2002-05-23 15: 12: 40Z score: 100 can be this: When an additional task is added, the interface thread generates a task management thread. The task management thread is responsible for generating / managing downloading threads, as well as interactions with the interface.

In addition, if you have a higher efficiency, you can make a thread pool for task management and download threads, to reduce system overhead TOP replies: kevin_qing () () Reputation: 103 2002-05-23 15: 14: 44Z score: 0 You can also set up a dominant download thread in each task download thread, which is responsible for managing other download threads of the task, flashget should be the TOP replies: ColdSea_2000 (Zhang Hai) () Reputation: 100 2002- 05-28 01: 24: 58Z score: 0 to Kevin_QING: After downloading the thread in each task, you have added a different non-download thread, specifically manage the download thread! I put this download function packaged in In a class, such as: Just in cdownload, there is a function startTask (CString URL) that can be used in cdownload, the URL is the resource address; I originally thought that this function is called in other classes, as long as you create a The local variables of the class can achieve multiple tasks; but in facts do not work! And global variables can be, for example: cdownload dw; (DW is global variable) DW.StartTask (String); this can be downloaded! Later, Your tip, I think if you generate interface threads for each task, but how can you make these interfaces? I am using a middle Dialog manages each task! But only one is downloaded; Dialog Focus, Click on the other things! If you use the interface multithreading, how to make Dialog you can't see? And automatically destroy it when the task is over? Thank you! You are grateful! TOP replies: kevin_qing () () Reputation: 103 2002-06-01 11: 40: 55Z score: 0 You probably didn't understand what I meant :)

I said the interface thread is actually your main window / dialog message loop. If you are packaged in an object, for example:

Class Ctask {char URL [1024]; // ....} DWORD WINAPI TASKTHREAD (CDownload * Task) {Handle Hthreads [32]; for (int i = 0; i

Top Reply to: Kevin_Qing () () Reputation: 103 2002-06-01 11: 47: 01Z score: 0 In fact, this can only achieve multi-connection management only with single download thread, but the program is difficult to write TOP replies: ColdSea_2000 (Zhang Hai) () Reputation: 100 2002-06-06 15: 22: 49Z score: 0 I generated a WINTHREAD-based thread, according to the method of interfacing, realize multitasking download, thank you kevin_qing () prompt! thank you very much! The younger brother is served! Top Reply to: LGX1916 (Shallow Green) () Reputation: 98 2002-06-06 17: 54: 30Z Score: 0 Flag

转载请注明原文地址:https://www.9cbs.com/read-11264.html

New Post(0)