Method, device and client for delivering callback function to ui thread

A callback function and process function technology, applied in the Windows field, can solve problems such as poor update effect and invalid UI interface update, so as to improve user experience and avoid interface freeze effect

Active Publication Date: 2021-03-12
WUHAN DOUYU NETWORK TECH CO LTD
View PDF6 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] The purpose of the present invention is to provide a method of delivering a callback function to the UI thread, so as to solve the problem in the prior art that calling the UI update interface in the working thread is likely to cause invalid UI interface update and poor update effect
[0005] The purpose of the present invention is also to provide a device for delivering a callback function to the UI thread, so as to solve the problem in the prior art that calling the UI update interface in the working thread easily causes the UI interface update to be invalid and the update effect is not good
[0006] The purpose of the present invention is also to provide a client to solve the problem in the prior art that invoking the UI update interface in the working thread is likely to cause invalid UI interface update and poor update effect

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
  • Method, device and client for delivering callback function to ui thread
  • Method, device and client for delivering callback function to ui thread
  • Method, device and client for delivering callback function to ui thread

Examples

Experimental program
Comparison scheme
Effect test

no. 1 example

[0033] Please refer to figure 2 , is a functional block diagram of an apparatus 500 for delivering a callback function to a UI thread according to the first embodiment of the present invention. The device 500 for delivering the callback function to the UI thread can be applied to figure 1 The client 100 is shown. The apparatus 500 for delivering a callback function to a UI thread includes a window class registration module 510 , a window creation module 520 , an encapsulation module 530 , an identification module 540 , a message sending module 550 and a calling module 560 .

[0034] The window class registration module 510 is used for registering a window class, wherein the window class is associated with the window procedure function.

[0035] In this embodiment, the following procedure can be used to define a window procedure function, that is, LRESULT CALLBACKWndProcCallback(HWND window_handle,

[0036] UINT message,

[0037] WPARAM wparam,

[0038] LPARAM lparam);

...

no. 2 example

[0051] Please refer to image 3 , is a schematic flowchart of a method for delivering a callback function to a UI thread applied to the client 100 provided by the second embodiment of the present invention. It should be noted that the method for delivering the callback function to the UI thread described in the embodiment of the present invention does not image 3 And the specific sequence described below is limited, and its basic principles and technical effects are the same as those of the first embodiment. For brief description, the parts not mentioned in this embodiment can refer to the corresponding content in the first embodiment. It should be understood that, in other embodiments, the order of some steps in the method for delivering a callback function to the UI thread according to the present invention can be exchanged according to actual needs, or some steps can also be omitted or deleted. The following will be image 3 The specific process shown will be described i...

no. 3 example

[0067] Please refer to Figure 4 , is a schematic flowchart of a method for delivering a callback function to a UI thread applied to the client 100 provided by the third embodiment of the present invention. Compared with the second embodiment, the difference is that the method for delivering the callback function to the UI thread provided by the third embodiment of the present invention further includes:

[0068] Step S107, when the message received by the operating system does not have the message identifier, call a default message processing interface to process the message.

[0069] It can be understood that step S107 is executed after step S105. That is to say, in this embodiment, after the operating system receives the message, it needs to judge the message, if the message has the message identifier kMsgHaveWork, then execute step S106; if the message does not have the message identifier kMsgHaveWork , then execute step S107.

[0070] It can be understood that the step...

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

Embodiments of the present invention provide a method, device and client for delivering a callback function to a UI thread, which relate to the technical field of Windows. This method encapsulates the callback function running in the worker thread into a callback object and adds it to the task queue for execution, and sends a message from the worker thread to the preset window procedure function running in the UI thread. When the operating system receives the message , calling the window procedure function according to the message, and calling the callback object according to the window procedure function, so that the callback function runs in the UI thread. The method of delivering the callback function to the UI thread realizes delivering the callback function from the worker thread to the UI thread, so that the callback function runs in the UI thread, so as to perform an interface update operation in any worker thread, and avoid the time-consuming execution of the UI thread. The interface is stuck and unresponsive caused by background operations, which improves the user experience to a certain extent.

Description

technical field [0001] The present invention relates to the technical field of Windows, in particular to a method, device and client for delivering a callback function to a UI thread. Background technique [0002] A thread is the smallest unit that an operating system can perform operation scheduling. It is included in a process and is the actual operating unit in the process. There are mainly two types of threads in Windows programs: UI threads and worker threads. Among them, the UI thread is called the main thread, which contains only one form message loop, and there can only be one UI thread in the program, and all operations related to the user interface (User Interface, UI) must be performed in the UI thread, otherwise Calling the UI update interface will fail. A worker thread is an additional thread created during program running to perform time-consuming background operations, such as network communication and database operations. [0003] Usually, during the devel...

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 Patents(China)
IPC IPC(8): G06F9/50G06F9/54G06F9/448G06F9/451
Inventor 黄浩张文明陈少杰
Owner WUHAN DOUYU NETWORK TECH CO 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