A Thread Invocation Method, Device, Computer Device and Storage Medium

By determining the second thread matching the first terminal thread in the second terminal and using the thread to process the callback data, the problem of data transmission errors in a multi-threaded environment is solved, and the remote joint debugging process is achieved smoothly.

CN114217927BActive Publication Date: 2025-06-27DOUYIN VISION CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111518906.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-13
Publication Date
2025-06-27
Estimated Expiration
2041-12-13

AI Technical Summary

Technical Problem

During the debugging process of mobile application, the sending data in a multi-threaded environment is inconsistent with the thread used to return data, resulting in data transmission errors.

Method used

By receiving the target interface call request sent by the first terminal in the second terminal, a second thread matching the first thread is determined, and the callback data of the target interface is used to call the callback data, and finally the callback data and the identification information of the second thread are sent back to the first terminal.

Benefits of technology

Ensure that during the remote joint debugging process, the threads used to transmit data from the same interface are consistent, thereby avoiding data transmission errors and ensuring the smooth progress of the debugging process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114217927B_ABST
    Figure CN114217927B_ABST
Patent Text Reader

Abstract

The present disclosure provides a thread call method, apparatus, computer device, and storage medium. Among them, the method includes: receiving a target interface call request sent by a first terminal through a first thread transferrer; debugging the target interface based on a debugging method included in the target interface debugging request, and determining a second thread in a second terminal that matches the first thread based on first identification information of the first thread included in the target interface call request; using the second thread to call callback data corresponding to the target interface; and sending the callback data and second identification information to the first terminal through a second thread transferrer. In the embodiments of the present disclosure, it can be ensured that the first thread triggering the call and the second thread processing the call are threads for processing the same interface, that is, it can be ensured that the threads used to transmit data of the same interface are consistent, thereby ensuring the smooth progress of the remote joint debugging process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technologies, and in particular, to a thread calling method, apparatus, computer device, and storage medium. Background Art

[0002] With the development of Internet technologies, mobile application programs have penetrated into everyone's life, entertainment, study, and work. To determine whether a mobile application program can be used normally on a mobile device, it is usually necessary to debug the mobile application program. Since the software development kit (SDK) on the mobile device cannot be automatically debugged on a personal computer (PC), it is necessary to remotely call the interface corresponding to the SDK on the mobile device through the PC, so as to simulate debugging the SDK on the mobile device on the PC.

[0003] When there are many threads used to call an interface, it is easy to cause a situation where the threads used for sending data and receiving data corresponding to the same interface are inconsistent, resulting in data transmission errors. Summary of the Invention

[0004] Embodiments of the present disclosure at least provide a thread calling method, apparatus, computer device, and storage medium.

[0005] In a first aspect, an embodiment of the present disclosure provides a thread calling method, which is applied to simulating thread calls of a first terminal in a second terminal for remote joint debugging. Wherein, the thread calls involve calls of multiple threads, and the method includes:

[0006] Receiving a target interface call request sent by the first terminal through a first thread transferrer; the first thread transferrer is used to forward interface call requests for multiple threads of the first terminal; the target interface call request includes a debugging method for debugging a target interface;

[0007] Debugging the target interface based on the debugging method, and determining a second thread matching the first thread in the second terminal based on first identification information of the first thread included in the target interface call request;

[0008] Invoking, by using the second thread, the debugged callback data corresponding to the target interface;

[0009] Sending the callback data and second identification information of the second thread to the first terminal through a second thread transferrer.

[0010] In an alternative embodiment, determining the second thread matching the first thread in the second terminal based on the first identification information of the first thread included in the target interface call request includes:

[0011] Based on the first identification information of the first thread included in the target interface call request, determine whether the first thread is the main thread;

[0012] If the first thread is the main thread, determine the main thread in the second terminal as the second thread matching the first thread; if the first thread is not the main thread, call the locally stored thread mapping table through the second thread transferor, and search in the thread mapping table for the second identification information of the second thread having a mapping relationship with the first identification information of the first thread.

[0013] In an alternative embodiment, after searching in the thread mapping table for the second identification information of the second thread having a mapping relationship with the first identification information of the first thread, the method further includes:

[0014] When the second identification information having a mapping relationship with the first identification information is not found in the thread mapping table, create a new thread for calling the target interface, allocate new identification information to the new thread, and use the created new thread as the second thread matching the first thread.

[0015] In an alternative embodiment, sending the callback data and the second identification information of the second thread to the first terminal through the second thread transferor includes:

[0016] Serialize the callback data and the second identification information of the second thread through the second thread transferor to obtain a serialized data packet;

[0017] Send the serialized data packet to the first thread transferor of the first terminal.

[0018] In a second aspect, an embodiment of the present disclosure further provides a thread call method, which is applied to a scenario where a first terminal requests a second terminal for remote joint debugging, and the remote joint debugging involves the call of multiple threads. The method includes:

[0019] Send a target interface call request to the second terminal through the first thread transferor to request the second terminal to call the target interface to return the debugged callback data; the target interface call request includes a debugging method for debugging the target interface in the second terminal;

[0020] Receive the callback data and the second identification information of the second thread sent by the second terminal through the second thread transferor;

[0021] Based on the second identification information, determine a first thread in the first terminal that matches the second thread;

[0022] Forward the callback data to the first thread.

[0023] In an optional implementation manner, the sending the target interface call request to the second terminal through the first thread transferrer includes:

[0024] Receive a target application debugging request triggered by a user; the target application debugging request includes a target interface call request for debugging the target application;

[0025] In a case where it is determined that the software development kit in the first terminal cannot be debugged, send the target interface call request to the second terminal through the first thread transferrer.

[0026] In an optional implementation manner, before sending the target interface call request to the second terminal through the first thread transferrer, the method further includes:

[0027] Obtain, through the first thread transferrer, a request for the first thread to trigger a target interface call;

[0028] Generate the target interface call request based on the first identification information of the first thread and the interface information of the target interface.

[0029] In an optional implementation manner, the determining a first thread in the first terminal that matches the second thread based on the second identification information includes:

[0030] Call a locally stored thread mapping table through the first thread transferrer, and find, from the thread mapping table, the first identification information of the first thread that has a mapping relationship with the second identification information of the second thread.

[0031] In a third aspect, an embodiment of the present disclosure further provides a thread call device, which is applied to simulate thread calls of a first terminal in a second terminal for remote joint debugging. The thread call involves calls of multiple threads. The device includes:

[0032] A first receiving module, configured to receive a target interface call request sent by a first terminal through a first thread transferrer; the first thread transferrer is configured to forward interface call requests for multiple threads of the first terminal; the target interface call request includes a debugging method for debugging a target interface;

[0033] A first determination module, configured to debug the target interface based on the debugging method, and determine a second thread in the second terminal that matches the first thread based on first identification information of a first thread included in the target interface call request;

[0034] A call module, configured to call, by using the second thread, debugged callback data corresponding to the target interface;

[0035] A first sending module, configured to send the callback data and second identification information of the second thread to the first terminal through a second thread relay;

[0036] Fourthly, an embodiment of the present disclosure further provides a thread call device, which is applied to a scenario where a first terminal requests a second terminal for remote joint debugging, and the remote joint debugging involves calls of multiple threads. The device includes:

[0037] A second sending module, configured to send a target interface call request to the second terminal through a first thread relay to request the second terminal to call the target interface to return debugged callback data; the target interface call request includes a debugging method for debugging the target interface in the second terminal;

[0038] A second receiving module, configured to receive the callback data and second identification information of the second thread sent by the second terminal through the second thread relay;

[0039] A second determination module, configured to determine a first thread in the first terminal that matches the second thread based on the second identification information;

[0040] A forwarding module, configured to forward the callback data to the first thread.

[0041] Fifthly, an embodiment of the present disclosure further provides a computer device, including: a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the computer device runs, the processor communicates with the memory through the bus. When the machine-readable instructions are executed by the processor, the steps in the first aspect, or any possible implementation manner in the first aspect are executed.

[0042] Sixthly, an embodiment of the present disclosure further provides a computer device, including: a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the computer device runs, the processor communicates with the memory through the bus. When the machine-readable instructions are executed by the processor, the steps in the second aspect, or any possible implementation manner in the second aspect are executed.

[0043] In a seventh aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is run by a processor, it executes the steps in the above first aspect or any possible implementation manner in the first aspect.

[0044] In an eighth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is run by a processor, it executes the steps in the above second aspect or any possible implementation manner in the second aspect.

[0045] In the thread calling method provided by the embodiment of the present disclosure, in a remote joint debugging scenario involving multiple threads, a second terminal (mobile terminal) that provides callback data can determine a second thread that matches the first thread according to the first identification information of the first thread included in the target interface call request sent by the first terminal (PC terminal) that requests remote joint debugging, which can ensure that the first thread that triggers the call and the second thread that processes the call are threads that process the same interface; and sending the callback data and the second identification information of the second thread to the first terminal can enable the first thread that matches the second thread to receive the callback data, thereby ensuring that the thread that triggers the call and the thread that receives the callback data are the same thread, ensuring that the threads used to transmit data of the same interface are consistent during remote joint debugging, and further ensuring the smooth progress of the remote joint debugging process.

[0046] In the thread calling method provided by the embodiment of the present disclosure, after receiving the callback data and the second identification information of the second thread sent by the second terminal (mobile terminal), the first terminal (PC terminal) that requests remote joint debugging can determine the first thread that matches the second thread in the first terminal according to the second identification information, thereby ensuring that the thread that triggers the call and the thread that receives the callback data are the same thread, ensuring that the threads used to transmit data of the same interface are consistent, and further ensuring the smooth progress of the remote joint debugging process.

[0047] To make the above objects, features, and advantages of the present disclosure more obvious and understandable, the following specific preferred embodiments are given, and in conjunction with the accompanying drawings, the detailed description is as follows. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] To more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following will briefly introduce the accompanying drawings required in the embodiments. The accompanying drawings are incorporated into the specification and form a part of the specification. These drawings show embodiments that conform to the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only show some embodiments of the present disclosure, and therefore should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.

[0049] Figure 1 Shows a flowchart of a thread calling method provided by an embodiment of the present disclosure;

[0050] Figure 2 Shows a flowchart of another thread calling method provided by an embodiment of the present disclosure;

[0051] Figure 3 Shows a flowchart of another thread calling method provided by an embodiment of the present disclosure;

[0052] Figure 4 Shows a schematic diagram of a remote joint debugging provided by an embodiment of the present disclosure;

[0053] Figure 5 Shows a schematic diagram of another remote joint debugging provided by an embodiment of the present disclosure;

[0054] Figure 6 Shows a schematic diagram of a thread calling device provided by an embodiment of the present disclosure;

[0055] Figure 7 Shows a schematic diagram of another thread calling device provided by an embodiment of the present disclosure;

[0056] Figure 8 Shows a schematic diagram of a computer device provided by an embodiment of the present disclosure;

[0057] Figure 9 Shows a schematic diagram of another computer device provided by an embodiment of the present disclosure. Detailed implementation manners

[0058] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only a part rather than all of the embodiments of the present disclosure. Usually, the components of the embodiments of the present disclosure described and illustrated in the accompanying drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the accompanying drawings is not intended to limit the scope of the claimed present disclosure, but merely represents selected embodiments of the present disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of the present disclosure without creative efforts shall fall within the scope of protection of the present disclosure.

[0059] To determine whether a mobile application can be used normally on a mobile device, it is usually necessary to debug the mobile application. Since the software development kit for mobile devices cannot be automatically debugged on a PC, the interfaces of the mobile SDK are usually debugged on the mobile device by remotely calling the mobile device interfaces from the PC, and the debugged callback data is then returned to the PC after the debugging is completed.

[0060] When there are many threads used to call an interface, it is easy to occur that the threads used for sending data and receiving data corresponding to the same interface are inconsistent, resulting in data transmission errors, which affects the accuracy of data transmission.

[0061] The present disclosure provides a thread calling method. In a remote joint debugging scenario involving multiple threads, a second terminal (mobile device) that provides callback data can determine a second thread that matches the first thread according to the first identification information of the first thread included in the target interface call request sent by the first terminal (PC) that requests remote joint debugging, which can ensure that the first thread that triggers the call and the second thread that processes the call are threads for processing the same interface; and sending the callback data and the second identification information of the second thread to the first terminal can enable the first thread that matches the second thread to receive the callback data, thereby ensuring that the thread that triggers the call and the thread that receives the callback data are the same thread, ensuring that the threads used for transmitting data of the same interface are consistent during remote joint debugging, and further ensuring the smooth progress of the remote joint debugging process.

[0062] Regarding the defects of the above solutions and the proposed solutions, they are all the results obtained by the inventors after practice and careful research. Therefore, the process of discovering the above problems and the solutions proposed by the present disclosure for the above problems in the following text should all be the contributions made by the inventors to the present disclosure during the process of the present disclosure.

[0063] It should be noted that similar reference numerals and letters represent similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.

[0064] To facilitate the understanding of this embodiment, first, a thread calling method disclosed in the embodiments of the present disclosure will be introduced in detail. The execution subject of the thread calling method provided by the embodiments of the present disclosure is generally a computer device with certain computing capabilities.

[0065] The thread calling method of the embodiments of the present disclosure is applied to the scenario where a first terminal requests a second terminal for remote joint debugging, where the remote joint debugging involves the calling of multiple threads. In the embodiments of the present disclosure, the first terminal and the second terminal can be any two independent operating environments. For example, the first terminal is a PC terminal, the second terminal is a mobile terminal, or the first terminal is a mobile terminal, and the second terminal is also a mobile terminal, or the first terminal is a PC terminal, and the second terminal is also a PC terminal. In the embodiments of the present disclosure, the thread calling method is described by taking the first terminal as a PC terminal and the second terminal as a mobile terminal as an example. First, the thread calling method provided by the embodiments of the present disclosure is described by taking the execution entity as the second terminal (i.e., a mobile terminal or a mobile emulator) as an example.

[0066] See Figure 1 As shown, it is a flowchart of a thread calling method provided by the embodiments of the present disclosure. The method includes S101 to S104, where:

[0067] S101: Receive a target interface call request sent by the first terminal through the first thread transferrer; the first thread transferrer is used to forward interface call requests for multiple threads of the first terminal; the target interface call request includes a debugging method for debugging a target interface.

[0068] In the embodiments of the present disclosure, the first terminal may refer to the terminal that requests the second terminal for remote joint debugging, that is, a PC terminal. The second terminal may refer to the terminal that provides callback data for the first terminal, that is, a mobile terminal or a mobile emulator. An SDK to be debugged runs on the second terminal, and the SDK running on the second terminal cannot be automatically debugged on the first terminal. Therefore, the first terminal sends a target interface debugging request to the second terminal, and then the second terminal debugs the target interface corresponding to the target SDK based on the debugging method included in the target interface debugging request to obtain the debugging result of the SDK (i.e., the callback data in this article). Finally, the second terminal sends the debugging result to the first terminal to implement remote debugging of the SDK running on the second terminal by the first terminal.

[0069] In the embodiments of the present disclosure, the received target interface call request may be a serialized data packet generated after a first thread of the first terminal triggers a debugging request. The data packet may include information such as the first identification information of the first thread, the name of the target interface involved in debugging the target SDK, the name of the debugging method, the parameter names used in the debugging method, the number of parameters, the parameter types, and the parameter values. The corresponding target interface can be determined according to the name of the target interface involved in debugging the target SDK included in the target interface call request, and then the target interface can be debugged according to information such as the name of the debugging method, the parameter names used in the debugging method, the number of parameters, the parameter types, and the parameter values to obtain the debugging result of the target interface.

[0070] The first thread transferrer in the embodiments of the present disclosure may refer to a proxy server set on the first terminal. The second thread transferrer may refer to an installed software set on the second terminal. The first terminal may include multiple first threads, and the first threads may send interface call requests. The first thread transferrer may forward data in at least one of the first threads in the first terminal. The second terminal may include multiple second threads, and the second threads are used to call callback data of a target interface. The second thread transferrer may forward data in at least one of the second threads in the second terminal.

[0071] As Figure 2 As shown, the PC side includes multiple threads. The first thread transferrer may receive a target interface call request sent by at least one first thread in the PC side, and then send the target interface call request to the second thread transferrer on the mobile side through the network module, and receive the debugging result of the target SDK returned by the second thread transferrer through the network module, and return the callback data to the PC side.

[0072] The second thread transferrer is used to receive the target interface call request sent by the first thread transferrer through the network module, parse the target interface call request to obtain the information included in the target interface call request, and then send it to the second thread in the mobile side or the mobile simulator according to the target interface and the target debugging method, and finally return the callback data in the second thread to the first thread transferrer through the network module.

[0073] S102: Debug the target interface based on the debugging method, and determine the second thread in the second terminal that matches the first thread based on the first identification information of the first thread included in the target interface call request.

[0074] As described above, the first terminal may include multiple first threads, and the second terminal also includes multiple second threads. To avoid the situation where the threads used to transmit the target interface call request are inconsistent with the threads used to transmit the corresponding callback data, first, the second thread transferrer may parse the target interface call request to obtain the first identification information of the first thread included in the target interface call request, and then determine the second thread in the second terminal that matches the first thread based on the first identification information.

[0075] To ensure the accuracy and efficiency of the second thread, in one implementation, the second thread translator can be used to call the locally stored thread mapping table, and the second identification information of the second thread that has a mapping relationship with the first identification information of the first thread can be found from the thread mapping table, and the thread corresponding to the second identification information is used as the second thread that matches the first thread. Among them, the first thread and the second thread that matches the first thread can be threads that process data of the same interface. Here, the thread mapping table can be determined according to the first identification information and the corresponding second identification information during the historical thread call process.

[0076] In a specific implementation, both the first terminal and the second terminal usually include a main thread and at least one sub-thread. When the received target interface call request is sent through the main thread of the first terminal, by default, the callback data corresponding to the target interface is called through the main thread of the second terminal. Moreover, when returning the callback data, it is also sent through the main thread. When the received target interface call request is sent through a sub-thread of the first terminal, the thread mapping table can be used for lookup. Therefore, in one implementation, during the process of determining the second thread that matches the first thread, it can be determined whether the first thread is the main thread according to the first identification information of the first thread. If so, the main thread in the second terminal is directly used as the second thread that matches the first thread; if not, the second thread translator can be used to call the locally stored thread mapping table, and the second identification information of the second thread that has a mapping relationship with the first identification information of the first thread can be found from the thread mapping table.

[0077] For the first identification information of the first thread included in the target interface call request, when the thread mapping table contains the second identification information corresponding to the first identification information, the above thread mapping table can be directly used to determine the second thread.

[0078] In one implementation, when the thread mapping table does not contain the second identification information corresponding to the first identification information, that is, when the second identification information that has a mapping relationship with the first identification information cannot be found in the thread mapping table, a new thread for calling the target interface is created, a new identification information is assigned to the new thread, and the created new thread is used as the second thread that matches the first thread.

[0079] The created new thread can process data of the same target interface as the first thread. For the convenience of subsequent quick lookup, the new identification information assigned to the new thread can be stored in the above thread mapping table together with the first thread identification of the corresponding first thread.

[0080] S103: Use the second thread to call the debugged callback data corresponding to the target interface.

[0081] Here, the debugging method and the target interface involved in the target SDK included in the target interface call request can be used to debug the target SDK, and the debugging result corresponding to the target SDK, that is, the callback data, is called by the second thread.

[0082] S104: Send the callback data and the second identification information of the second thread to the first terminal through the second thread transferrer.

[0083] In the process of sending the callback data to the first terminal, the callback data and the second identification information of the second thread can be serialized through the second thread transferrer to obtain a serialized data packet, that is, the serialized data packet contains the callback data and the second identification information of the second thread, and then the serialized data packet is sent to the first thread transferrer of the first terminal.

[0084] The first thread transferrer can parse the received serialized data packet, find the first thread matching the second thread according to the second identification information of the second thread obtained by parsing, and finally the first thread returns the callback data contained in the serialized data packet to the first terminal.

[0085] Hereinafter, the thread call method provided by the embodiments of the present disclosure will be described by taking the execution subject as the first terminal (i.e., the PC side) as an example.

[0086] See Figure 3 As shown, it is a flowchart of another thread call method provided by the embodiments of the present disclosure. The method includes S301 to S304, wherein:

[0087] S301: Send a target interface call request to the second terminal through the first thread transferrer to request the second terminal to call the target interface to return the debugged callback data; the target interface call request includes a debugging method for debugging the target interface in the second terminal.

[0088] In the embodiments of the present disclosure, as Figure 2 shown, the first terminal may include multiple first threads for triggering interface call requests, and each first thread has a corresponding first identification information. The first thread transferrer may refer to a proxy server set on the first terminal. The first thread transferrer may be used to forward interface call requests for multiple first threads.

[0089] Before sending the target interface call request to the second terminal through the first thread relay, the first thread relay can obtain the request for the first thread to trigger the target interface call; then, based on the first identification information of the first thread and the interface information of the target interface, a target interface call request is generated. Among them, the interface information of the target interface may include information such as the name of the target interface involved in debugging the target SDK, the name of the debugging method, the parameter names used in the debugging method, the number of parameters, the parameter types, and the parameter values.

[0090] Here, the first identification information of the first thread and the interface information of the target interface can be serialized to obtain a serialized data packet, that is, the target interface call request.

[0091] Here, the network module can be used to send the target interface call request to the network module of the second terminal, so that the second terminal can determine the corresponding target interface according to the target interface name included in the target interface call request, and then the target interface can be debugged according to the information such as the name of the debugging method, the parameter names used in the debugging method, the number of parameters, the parameter types, and the parameter values to obtain the debugging result of the target interface, that is, the callback data, and return the debugged callback data.

[0092] S302: Receive the callback data sent by the second terminal through the second thread relay and the second identification information of the second thread.

[0093] Here, the serialized data packet can be received, and the data packet contains the callback data and the second identification information of the second thread.

[0094] The callback data here can be that after the second thread relay in the second terminal receives the target interface call request, it parses the target interface call request to obtain the first identification information of the first thread included in the target interface call request, and then determines the second thread that matches the first thread according to the first identification information. Then, using the second thread, the target interface corresponding to the target SDK is debugged according to the interface information of the target interface included in the target interface call request to obtain the callback data, and the second thread relay returns the callback data.

[0095] In the embodiments of the present disclosure, determining the second thread that matches the first thread according to the first identification information can refer to the process in the foregoing embodiments, which will not be elaborated here.

[0096] S303: Based on the second identification information, determine the first thread in the first terminal that matches the second thread.

[0097] The first thread transferrer can, according to the second identification information of the second thread, look up the first identification information of the first thread that has a mapping relationship with the second identification information of the second thread from the locally stored thread mapping table, and use the thread corresponding to the first identification information as the first thread that matches the second thread.

[0098] S304: Forward the callback data to the first thread.

[0099] After determining the first thread, the first thread transferrer forwards the callback data to the first thread.

[0100] The embodiments of the present disclosure also provide a method for executing such thread calls during the process of remotely debugging a game application on a mobile device or a mobile emulator from a game debugging PC. Here, the mobile device or the mobile emulator can be local or remotely connected. As Figure 4 shown, when the game debugging PC is debugging a mobile device or a mobile emulator, the game debugging PC is the first terminal. It can obtain a target interface call request for the SDK corresponding to the game application to be sent to the mobile device or the mobile emulator at the engine bridge layer of the game debugging PC through a proxy server, and send the target interface call request to the installation software module of the mobile device or the mobile emulator. Here, the target interface call request sent to the installation software module of the mobile device or the mobile emulator can be after serialization processing.

[0101] The installation software module of the mobile device or the mobile emulator can perform deserialization processing on the received information to obtain the target interface call request. Then, it calls the target interface in its own SDK according to the target interface call request to perform debugging and obtain a debugging result, that is, callback data. The mobile device or the mobile emulator then returns it to the proxy server of the game debugging PC through the installation software module.

[0102] Among them, the proxy server in the game debugging PC can forward interface call requests for multiple threads. The target interface call request sent by the proxy server can include a debugging method for debugging the target interface and the first identification information of the first thread.

[0103] After receiving the target interface call request, the mobile device or the mobile emulator can debug the target interface according to the debugging method, and can determine a second thread that matches the first thread according to the first identification information of the first thread. Then, it uses the second thread to return the callback data obtained after debugging the target interface to the proxy server of the game debugging PC through the installation software module, and at the same time, the second identification information of the second thread is also returned. Here, the callback data and the second identification information of the second thread can be serialized to obtain a data packet.

[0104] The proxy server on the game debugging PC side can parse the received serialized data packets, then obtain the included callback data and the second identification information of the second thread, find the first thread that matches the second thread from them, and then use the first thread to return the callback data to the game debugging PC side.

[0105] On this basis, as Figure 5 shown, in the game debugging PC side environment, the PC side can connect to the engine bridging layer through the target interface. The engine bridging layer intercepts the target interface call request of the mobile SDK to be debugged in the game engine through the plug-in, and sends the target interface call request to the proxy server on the PC side. The proxy server serializes it and forwards the serialized information to the installed software module in the real machine (i.e., the mobile side) environment through the network module. The installed software module can call the debug bridge to deserialize the information from the proxy server, and then obtain the debug result, that is, the callback data, by calling the native module according to the debug method for debugging the target interface included in the target interface call request, and synchronously return or asynchronously return the callback data to the PC side.

[0106] Specifically, the mobile side can send the callback data to the game debugging PC side based on the sending method indicated by the mobile SDK. Among them, the sending method indicated by the mobile SDK can include the synchronous method or the asynchronous method. Specifically, the synchronous method can refer to taking the process of the game debugging PC side sending the target interface call request of the mobile SDK to be debugged to the mobile side and the mobile side returning the callback data to the game debugging PC side as a complete process, which can ensure the integrity of the process and reduce the probability of process errors.

[0107] Between the two steps of the game debugging PC side sending the target interface debug request of the mobile SDK to be debugged to the mobile side and the mobile side returning the debug result to the game debugging PC side, the mobile side needs a certain amount of time for debugging operations. If the two steps are continuous as a process, the debugging time will cause the application debugging of the game debugging PC side to freeze. Therefore, the asynchronous method can take the game debugging PC side sending the target interface debug request of the mobile SDK to be debugged to the mobile side and the mobile side returning the callback data to the game debugging PC side as two processes to improve the fluency of the game debugging PC side for interface debugging.

[0108] Those skilled in the art can understand that in the above method of the specific implementation manner, the writing order of each step does not mean a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.

[0109] Based on the same inventive concept, an embodiment of the present disclosure also provides a thread calling device corresponding to the thread calling method. Since the principle of problem-solving of the device in the embodiment of the present disclosure is similar to that of the above-mentioned thread calling method in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be elaborated.

[0110] Referring Figure 6 As shown, it is a schematic architecture diagram of a thread calling device provided by an embodiment of the present disclosure, which is applied to simulate the thread calling of a first terminal in a second terminal for remote joint debugging. The thread calling involves the calling of multiple threads. The device includes:

[0111] A first receiving module 601, configured to receive a target interface call request sent by the first terminal through a first thread transferrer; the first thread transferrer is used to forward interface call requests for multiple threads of the first terminal; the target interface call request includes a debugging method for debugging the target interface.

[0112] A first determining module 602, configured to debug the target interface based on the debugging method, and determine a second thread in the second terminal that matches the first thread based on the first identification information of the first thread included in the target interface call request.

[0113] A calling module 603, configured to use the second thread to call the debugged callback data corresponding to the target interface.

[0114] A first sending module 604, configured to send the callback data and the second identification information of the second thread to the first terminal through a second thread transferrer.

[0115] In an optional implementation manner, the first determining module 602 is specifically configured to:

[0116] Judge whether the first thread is the main thread based on the first identification information of the first thread included in the target interface call request;

[0117] If the first thread is the main thread, determine the main thread in the second terminal as the second thread that matches the first thread; if the first thread is not the main thread, call the locally stored thread mapping table through the second thread transferrer, and find the second identification information of the second thread that has a mapping relationship with the first identification information of the first thread from the thread mapping table.

[0118] In an optional implementation manner, the device further includes:

[0119] A creation module, configured to create a new thread for invoking the target interface when the second identification information having a mapping relationship with the first identification information cannot be found in the thread mapping table, allocate new identification information for the new thread, and use the created new thread as the second thread matching the first thread.

[0120] In an optional implementation manner, the first sending module 604 is specifically configured to:

[0121] Serialize the callback data and the second identification information of the second thread through a second thread transferrer to obtain a serialized data packet;

[0122] Send the serialized data packet to the first thread transferrer of the first terminal.

[0123] Refer to Figure 7 As shown, it is a schematic architecture diagram of a thread invocation device provided by an embodiment of the present disclosure, which is applied to a scenario where a first terminal requests a second terminal for remote joint debugging. The remote joint debugging involves the invocation of multiple threads. The device includes:

[0124] A second sending module 701, configured to send a target interface invocation request to a second terminal through a first thread transferrer to request the second terminal to invoke the target interface to return debugged callback data; the target interface invocation request includes a debugging method for debugging the target interface in the second terminal;

[0125] A second receiving module 702, configured to receive the callback data and the second identification information of the second thread sent by the second terminal through a second thread transferrer;

[0126] A second determination module 703, configured to determine a first thread in the first terminal that matches the second thread based on the second identification information;

[0127] A forwarding module 704, configured to forward the callback data to the first thread.

[0128] In an optional implementation manner, the second sending module 701 is specifically configured to receive a target application debugging request triggered by a user; the target application debugging request includes a target interface invocation request for debugging the target application;

[0129] In the case where it is determined that the software development kit in the first terminal cannot be debugged, send the target interface invocation request to the second terminal through the first thread transferrer.

[0130] In an optional implementation manner, the device further includes:

[0131] An acquisition module, configured to obtain a request for triggering a target interface call by a first thread through a first thread transferrer;

[0132] A generation module, configured to generate the target interface call request based on the first identification information of the first thread and the interface information of the target interface.

[0133] In an optional implementation manner, the second determination module 703 is specifically configured to: call a locally stored thread mapping table through the first thread transferrer, and look up the first identification information of the first thread that has a mapping relationship with the second identification information of the second thread from the thread mapping table.

[0134] Descriptions of the processing flows of the various modules in the device and the interaction flows between the various modules may refer to the relevant descriptions in the above method embodiments, and will not be elaborated here.

[0135] Based on the same inventive concept, an embodiment of the present disclosure further provides a computer device. Referring to Figure 8 As shown, it is a schematic structural diagram of a computer device 800 provided by an embodiment of the present disclosure, including a processor 801, a memory 802, and a bus 803. Among them, the memory 802 is used to store execution instructions, including an internal memory 8021 and an external memory 8022; the internal memory 8021 here is also called the main memory, and is used to temporarily store the operation data in the processor 801 and the data exchanged with the external memory 8022 such as a hard disk. The processor 801 exchanges data with the external memory 8022 through the internal memory 8021. When the computer device 800 runs, the processor 801 communicates with the memory 802 through the bus 803, so that the processor 801 executes the following instructions:

[0136] Receive a target interface call request sent by a first terminal through a first thread transferrer; the first thread transferrer is used to forward interface call requests for multiple threads of the first terminal; the target interface call request includes a debugging method for debugging the target interface;

[0137] Debug the target interface based on the debugging method, and determine a second thread in the second terminal that matches the first thread based on the first identification information of the first thread included in the target interface call request;

[0138] Use the second thread to call the callback data corresponding to the target interface;

[0139] Send the callback data and the second identification information of the second thread to the first terminal through a second thread transferrer.

[0140] Based on the same inventive concept, an embodiment of the present disclosure further provides a computer device. Referring toFigure 9 As shown in the figure, it is a schematic structural diagram of a computer device 900 provided by an embodiment of the present disclosure, including a processor 901, a memory 902, and a bus 903. Among them, the memory 902 is used to store execution instructions, including an internal memory 9021 and an external memory 9022; the internal memory 9021 here is also called the main memory, which is used to temporarily store the operation data in the processor 901 and the data exchanged with the external memory 9022 such as a hard disk. The processor 901 exchanges data with the external memory 9022 through the internal memory 9021. When the computer device 900 runs, the processor 901 communicates with the memory 902 through the bus 903, so that the processor 901 executes the following instructions:

[0141] Send a target interface call request to a second terminal through a first thread relay to request the second terminal to call the target interface to return debugged callback data; the target interface call request contains a debugging method for debugging the target interface in the second terminal;

[0142] Receive the callback data sent by the second terminal through a second thread relay and the second identification information of the second thread;

[0143] Based on the second identification information, determine a first thread in the first terminal that matches the second thread;

[0144] Forward the callback data to the first thread.

[0145] An embodiment of the present disclosure also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is run by a processor, it executes the steps of the thread calling method described in the above method embodiment. Among them, the storage medium can be a volatile or non-volatile computer-readable storage medium.

[0146] An embodiment of the present disclosure also provides a computer program product, which carries program codes. The instructions included in the program codes can be used to execute the steps of the thread calling method described in the above method embodiment. For specific details, please refer to the above method embodiment and will not be elaborated here.

[0147] Among them, the above computer program product can be specifically implemented in a manner of hardware, software, or a combination thereof. In an optional embodiment, the computer program product is specifically embodied as a computer storage medium. In another optional embodiment, the computer program product is specifically embodied as a software product, such as a Software Development Kit (SDK), etc.

[0148] Those skilled in the art can clearly understand that for the convenience and conciseness of description, the specific working processes of the systems and devices described above can refer to the corresponding processes in the foregoing method embodiments, and will not be elaborated herein. In several embodiments provided in the present disclosure, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division, and there may be other division methods in actual implementation. For another example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the couplings or direct couplings or communication connections shown or discussed with each other can be through some communication interfaces. The indirect couplings or communication connections of the devices or units can be in electrical, mechanical, or other forms.

[0149] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0150] In addition, in each embodiment of the present disclosure, the functional units can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit.

[0151] If the functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such an understanding, the technical solution of the present disclosure, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present disclosure. The foregoing storage medium includes: various media that can store program codes such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs.

[0152] Finally, it should be noted that the above-described embodiments are only specific embodiments of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than limiting them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that any person skilled in the art within the technical scope disclosed by the present disclosure can still modify the technical solutions described in the foregoing embodiments, or can easily think of changes, or perform equivalent replacements on some of the technical features; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should all be covered by the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.

Claims

1. A thread calling method, characterized in that, Applied to simulate the thread calls of the first terminal in the second terminal for remote joint debugging, the thread calls involve the calls of multiple threads, and the method includes: Receiving a target interface call request sent by the first terminal through a first thread transferrer; the first thread transferrer is used to forward interface call requests for multiple threads of the first terminal; the target interface call request contains a debugging method for debugging the target interface; Debugging the target interface based on the debugging method, and determining a second thread in the second terminal that matches the first thread based on the first identification information of the first thread included in the target interface call request; Using the second thread to call the debugged callback data corresponding to the target interface; Sending the callback data and the second identification information of the second thread to the first terminal through a second thread transferrer; Wherein, determining the second thread in the second terminal that matches the first thread based on the first identification information of the first thread included in the target interface call request includes: Judging whether the first thread is the main thread based on the first identification information of the first thread included in the target interface call request; If the first thread is the main thread, determining the main thread in the second terminal as the second thread that matches the first thread; if the first thread is not the main thread, calling a locally stored thread mapping table through the second thread transferrer, and searching in the thread mapping table for the second identification information of the second thread that has a mapping relationship with the first identification information of the first thread.

2. The method according to claim 1, wherein After searching in the thread mapping table for the second identification information of the second thread that has a mapping relationship with the first identification information of the first thread, the method further includes: When the second identification information that has a mapping relationship with the first identification information is not found in the thread mapping table, creating a new thread for calling the target interface, allocating new identification information for the new thread, and using the created new thread as the second thread that matches the first thread.

3. According to the method described in claim 1, sending the callback data and the second identification information of the second thread to the first terminal through a second thread transferrer includes: Serializing the callback data and the second identification information of the second thread through the second thread transferrer to obtain a serialized data packet; Sending the serialized data packet to the first thread transferrer of the first terminal.

4. A thread calling method, characterized in that, Applied to the scenario where the first terminal requests the second terminal for remote joint debugging, the remote joint debugging involves the calls of multiple threads, and the method includes: Sending a target interface call request to the second terminal through a first thread transferrer to request the second terminal to call the target interface to return debugged callback data; the target interface call request contains a debugging method for debugging the target interface in the second terminal; Receiving the callback data and the second identification information of the second thread sent by the second terminal through a second thread transferrer; Based on the second identification information, determine the first thread in the first terminal that matches the second thread; Forward the callback data to the first thread; Wherein, the second terminal determines the second thread in the second terminal that matches the first thread through the following steps: Based on the first identification information of the first thread included in the target interface call request, determine whether the first thread is the main thread; If the first thread is the main thread, determine the main thread in the second terminal as the second thread that matches the first thread; if the first thread is not the main thread, call the locally stored thread mapping table through the second thread transferor, and search the thread mapping table for the second identification information of the second thread that has a mapping relationship with the first identification information of the first thread.

5. The method according to claim 4, wherein The sending the target interface call request to the second terminal through the first thread transferor includes: Receive a target application debugging request triggered by a user; the target application debugging request includes a target interface call request for debugging the target application; In the case where it is determined that the software development kit in the first terminal cannot be debugged, send the target interface call request to the second terminal through the first thread transferor.

6. The method according to claim 4, characterized in that Before sending the target interface call request to the second terminal through the first thread transferor, the method further includes: Obtain, through the first thread transferor, a request for the first thread to trigger a target interface call; Generate the target interface call request based on the first identification information of the first thread and the interface information of the target interface.

7. The method according to claim 4, wherein The determining, based on the second identification information, the first thread in the first terminal that matches the second thread includes: Call the locally stored thread mapping table through the first thread transferor, and search the thread mapping table for the first identification information of the first thread that has a mapping relationship with the second identification information of the second thread.

8. A thread calling device, characterized in that, Applied to simulate thread calls of a first terminal in a second terminal for remote joint debugging, the thread calls involve calls of multiple threads, and the device includes: A first receiving module, configured to receive a target interface call request sent by the first terminal through a first thread transferor; the first thread transferor is used to forward interface call requests for multiple threads of the first terminal; the target interface call request includes a debugging method for debugging a target interface; A first determining module, configured to debug the target interface based on the debugging method, and determine, based on the first identification information of the first thread included in the target interface call request, the second thread in the second terminal that matches the first thread; A calling module, configured to use the second thread to call the debugged callback data corresponding to the target interface; A first sending module, configured to send the callback data and the second identification information of the second thread to the first terminal through a second thread transferor; Wherein, the first determination module is configured to: based on the first identification information of the first thread included in the target interface call request, determine whether the first thread is the main thread; if the first thread is the main thread, determine the main thread in the second terminal as the second thread matching the first thread; if the first thread is not the main thread, call the locally stored thread mapping table through the second thread transferor, and find the second identification information of the second thread that has a mapping relationship with the first identification information of the first thread from the thread mapping table.

9. A thread calling device, characterized in that, Applied to the scenario where a first terminal requests a second terminal for remote joint debugging, the remote joint debugging involves the call of multiple threads, and the device includes: A second sending module, configured to send a target interface call request to the second terminal through a first thread transferor, so as to request the second terminal to call the target interface to return the debugged callback data; the target interface call request includes a debugging method for debugging the target interface in the second terminal. A second receiving module, configured to receive the callback data and the second identification information of the second thread sent by the second terminal through the second thread transferor. A second determination module, configured to determine the first thread in the first terminal that matches the second thread based on the second identification information. A forwarding module, configured to forward the callback data to the first thread. Wherein, the second terminal determines the second thread in the second terminal that matches the first thread through the following steps: Based on the first identification information of the first thread included in the target interface call request, determine whether the first thread is the main thread. If the first thread is the main thread, determine the main thread in the second terminal as the second thread matching the first thread; if the first thread is not the main thread, call the locally stored thread mapping table through the second thread transferor, and find the second identification information of the second thread that has a mapping relationship with the first identification information of the first thread from the thread mapping table.

10. A computer device, characterized in that, Including: A processor, a memory, and a bus, the memory stores machine-readable instructions executable by the processor. When the computer device runs, the processor communicates with the memory through the bus. When the machine-readable instructions are executed by the processor, the steps of the thread call method according to any one of claims 1 to 3 or the steps of the thread call method according to any one of claims 4 to 7 are executed.

11. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium. When the computer program is run by the processor, the steps of the thread call method according to any one of claims 1 to 3 or the steps of the thread call method according to any one of claims 4 to 7 are executed.

Citation Information

Patent Citations

  • An inter-thread communication method and device

    CN109918209A

  • Application debugging method and device, electronic equipment and computer readable storage medium

    CN112882950A