Thread pool management method and device thereof, computer terminal and storage medium
A management method and thread pool technology, applied in the computer field, can solve problems such as inefficiency, non-continuousness, occupying too many resources, etc., and achieve the effect of saving resources and improving response speed.
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0036] The application provides a thread pool management method. In this embodiment, the method is based on Qthread in Qt programming. For details, refer to figure 1 come to understand.
[0037] Exemplarily, the thread pool management method includes:
[0038] Step S100, create a number of task threads, then add the number of task threads to the thread pool management queue, and monitor whether there is a task request message.
[0039] When a program starts, it will first create (using the words in the disclosure, create) the main thread of the program. The main thread has its own main event loop, and the thread pool is maintained by the main event loop. The main thread is mainly used to handle the work of component classes and several related classes; the task thread is a worker thread, which is mainly responsible for processing the tasks assigned by the main thread. For the program, as long as it is running and interacting with the user, it will generate Tasks that require...
Embodiment 2
[0061] The present application also provides a thread pool management device, such as Figure 4 As shown, the device includes a thread pool module 10, a task object module 11 and an allocation execution module 12, wherein:
[0062] Thread pool module 10 creates a number of task threads, then adds the number of task threads to the thread pool management queue, and monitors whether there is a task request message;
[0063] A task object module 11, configured to create a task object of the requested task when the task request message is received, the task object including an object event loop and an execution function related to the task;
[0064] Assign execution module 12, assign a task thread for the task object from the thread pool management queue, and host the object event loop to the task thread, so that the task thread calls the execution function to execute the task object. current task.
[0065] Further, the embodiments of the present application also provide a comput...
PUM
Abstract
Description
Claims
Application Information
- R&D Engineer
- R&D Manager
- IP Professional
- Industry Leading Data Capabilities
- Powerful AI technology
- Patent DNA Extraction
Browse by: Latest US Patents, China's latest patents, Technical Efficacy Thesaurus, Application Domain, Technology Topic, Popular Technical Reports.
© 2024 PatSnap. All rights reserved.Legal|Privacy policy|Modern Slavery Act Transparency Statement|Sitemap|About US| Contact US: help@patsnap.com