Processing method and device for achieving synchronous call based on asynchronous call
A technique for asynchronously calling and processing methods, applied in the computer field
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0052] This embodiment provides a processing method for implementing synchronous calls based on asynchronous calls, please refer to figure 1 , the method includes:
[0053] Step S101: Obtain a preset first function for asynchronous calling, the parameters of the first function include a first callback function;
[0054] Step S102: generating a second function for synchronous calling, wherein the parameters of the second function include a second callback function and time, and there is a corresponding relationship between the second callback function and the first callback function;
[0055] Step S103: according to the corresponding relationship, call the first function in the second function, and call the first callback function asynchronously through the first function;
[0056] Step S104: If the waiting time for obtaining the execution result of the first callback function is less than the value of the time parameter, call the second callback function synchronously through...
Embodiment 2
[0099] An embodiment of the present invention provides a processing device for implementing synchronous calls based on asynchronous calls. Please refer to figure 2 , the device consists of:
[0100] An acquisition module 201, configured to acquire a preset first function for asynchronous invocation, where the parameters of the first function include a first callback function;
[0101] A generation module 202, configured to generate a second function for synchronous calling according to parameters of the first function, wherein the parameters of the second function include a second callback function and time;
[0102] An asynchronous calling module 203, configured to construct a correspondence between the second callback function and the first callback function, and according to the correspondence, call the first function in the second function, through the first callback function A function calls the first callback function asynchronously;
[0103] A synchronous calling mod...
Embodiment 3
[0112] An embodiment of the present invention provides a computer-readable storage medium 300, on which a computer program 311 is stored. When the program is executed by a processor, the following steps are implemented:
[0113] Obtaining a preset first function for asynchronous invocation, where parameters of the first function include a first callback function;
[0114] generating a second function for synchronous calling according to parameters of the first function, wherein the parameters of the second function include a second callback function and time;
[0115] constructing a correspondence between the second callback function and the first callback function, and calling the first function in the second function according to the correspondence, and calling the first callback asynchronously through the first function a callback function;
[0116] If the waiting time for obtaining the execution result of the first callback function is less than the value of the time para...
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