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.

Pending Publication Date: 2022-01-28
UBTECH ROBOTICS CORP LTD
View PDF0 Cites 3 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

However, in object-oriented design, it is possible that a certain thread needs to independently undertake all the tasks of a certain object, and these tasks are not continuous, but isolated and fragmented, so that the thread will be scheduled multiple times, so there will be time-consuming, Either the efficiency is not high, or it takes up too many resources, etc.

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Thread pool management method and device thereof, computer terminal and storage medium
  • Thread pool management method and device thereof, computer terminal and storage medium
  • Thread pool management method and device thereof, computer terminal and storage medium

Examples

Experimental program
Comparison scheme
Effect test

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...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention discloses a thread pool management method and a device thereof, a terminal and a storage medium, and the method comprises the steps: creating a plurality of task threads, then adding the plurality of task threads into a thread pool management queue, and monitoring whether there is a task request message; when a task request message is received, creating a corresponding task object, wherein the task object comprises an object event loop and an execution function related to a current task; distributing a task thread for the task object from a thread pool management queue, and cyclically hosting an object event to the task thread, so that the task thread calls the execution function to execute the current task. Through the object-oriented thread pool management method, the threads can better serve upper-layer applications.

Description

technical field [0001] The present invention relates to the computer field, in particular to a thread pool management method, device, computer terminal and storage medium. Background technique [0002] Most of the currently widely used thread pools are used to perform certain time-consuming tasks and avoid repeated creation and destruction of threads. However, in object-oriented design, it is possible that a certain thread needs to independently undertake all the tasks of a certain object, and these tasks are not continuous, but isolated and scattered, so that the thread will be scheduled multiple times, so there will be time-consuming, Either the efficiency is not high, or it takes up too many resources. Contents of the invention [0003] In view of this, the application provides a thread pool management method, including: [0004] 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 tas...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Applications(China)
IPC IPC(8): G06F9/48G06F9/50G06F9/54
CPCG06F9/4881G06F9/5016G06F9/485G06F9/5022G06F9/546G06F9/542G06F2209/548G06F2209/5018G06F2209/5011
Inventor 周志平
Owner UBTECH ROBOTICS CORP LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products