A data processing method, device, storage medium and server

By judging and processing the objective functions among multiple candidate functions in the main thread, and using the slave thread to process it, the problem of excessive load on the main thread is solved, and the processing efficiency of the main thread is improved.

CN115220880BActive Publication Date: 2025-05-27NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110407982.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-15
Publication Date
2025-05-27
Estimated Expiration
2041-04-15

AI Technical Summary

Technical Problem

In the prior art, since the main thread needs to execute a large number of functions in the script layer, the main thread has a large load, which reduces the processing efficiency of the main thread.

Method used

By receiving the operation request, multiple candidate functions are determined according to the request type. When the main thread calls the objective function among these candidate functions, it is determined whether the objective function has the same target parameters as other functions. If present, and get the environment type of the target parameter in the objective function and other functions. When the target environment type is different from other environment types, control calls the target function from the thread for processing.

Benefits of technology

By separating the objective function that does not affect the operation of other functions from the main thread and processing it by the slave thread, the load of the main thread is reduced and the processing efficiency of the main thread is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115220880B_ABST
    Figure CN115220880B_ABST
Patent Text Reader

Abstract

An embodiment of the present application discloses a data processing method, apparatus, storage medium, and server. The method includes: receiving an operation request, and determining a plurality of candidate functions according to the request type of the operation request; when it is detected that the main thread calls a target function among the plurality of candidate functions, determining whether there are target parameters in the target function that are the same as those of other functions; when there are target parameters in the target function that are the same as those of other functions, obtaining the target environment type corresponding to the target parameters in the target function; obtaining the other environment type corresponding to the target parameters in other functions; when the target environment type is different from the other environment type, controlling the slave thread to call the target function and process the target function. By separating the target function that does not affect the operation of other functions from the main thread and controlling the slave thread to call the target function, the load of the main thread is reduced, and the processing efficiency of the main thread is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computers, and particularly to a data processing method, apparatus, computer-readable storage medium, and server. Background Art

[0002] In recent years, with the development and popularization of computer device technology, more and more Massive Multiplayer Online (MMO) games have emerged for users to experience. The servers corresponding to MMOs adopt a multi-threaded architecture, and independent modules or functions are manually assigned to different threads for execution. For example, one thread implements functions related to game scenes, and one thread is responsible for receiving and sending network data, etc. This architecture enables different tasks to be executed simultaneously, improving the throughput of the system and supporting a large number of players to play games online at the same time.

[0003] In the prior art, in addition to each sub-module being executed using an independent thread, the server often also requires a main thread to be responsible for services related to game-playing logic. The main thread responds to the callback functions of each sub-module, modifies player data, game data, responds to player requests, and executes timer and other game-play related business logics, and most of these business logics are written using scripting languages. Since there is only one main thread and all script-level functions are executed sequentially, the load of the main thread often plays a decisive role in the performance of the server.

[0004] In the process of researching and practicing the prior art, the inventors of this application found that in the prior art, since the main thread needs to execute a large number of functions in the script layer, the load of the main thread is large, reducing the processing efficiency of the main thread. Summary of the Invention

[0005] Embodiments of this application provide a data processing method and apparatus, which can reduce the load of the main thread and improve the processing efficiency of the main thread.

[0006] To solve the above technical problems, embodiments of this application provide the following technical solutions:

[0007] A data processing method includes:

[0008] Receiving an operation request, and determining a plurality of candidate functions according to the request type of the operation request;

[0009] When it is detected that the main thread calls a target function among the plurality of candidate functions, determining whether there are target parameters in the target function that are the same as those of other functions, where the other functions are other functions among the plurality of candidate functions except the target function;

[0010] When there are target parameters in the target function that are the same as those in other functions, obtain the target environment type corresponding to the target parameters in the target function;

[0011] Obtain the other environment types corresponding to the target parameters in other functions, where the other environment types are the environment types corresponding to the target parameters in candidate functions other than the target function that have the target parameters;

[0012] When the target environment type is different from the other environment types, control the slave thread to call the target function and process the target function.

[0013] A data processing device, comprising:

[0014] A determination module, configured to receive an operation request and determine a plurality of candidate functions according to the request type of the operation request;

[0015] A first judgment module, configured to, when detecting that the main thread calls a target function among a plurality of candidate functions, judge whether there are target parameters in the target function that are the same as those in other functions, where the other functions are other functions among the plurality of candidate functions except the target function;

[0016] A first acquisition module, configured to, when there are target parameters in the target function that are the same as those in other functions, obtain the target environment type corresponding to the target parameters in the target function;

[0017] A second acquisition module, configured to obtain the other environment types corresponding to the target parameters in other functions, where the other environment types are the environment types corresponding to the target parameters in candidate functions other than the target function that have the target parameters;

[0018] A first control module, configured to, when the target environment type is different from the other environment types, control the slave thread to call the target function and process the target function.

[0019] In some embodiments, the first control module includes:

[0020] An encapsulation sub-module, configured to, when the target environment type is different from the other environment types, encapsulate the target function into a target task, where the target task includes the parameters required to execute the target function and the execution logic between the parameters;

[0021] A determination sub-module, configured to obtain the environment type corresponding to each parameter in the target function and determine the environment value corresponding to each parameter under the environment type;

[0022] An allocation sub-module, configured to allocate the target task to the waiting queue corresponding to each environment value;

[0023] A control sub-module, configured to control a slave thread to obtain the target task from each of the waiting queues, and process the parameters of the target function according to the execution logic in the target task.

[0024] In some embodiments, the control sub-module includes:

[0025] A first determination unit, configured to determine whether the target task is the first task to be executed in the waiting queue corresponding to each environmental value;

[0026] A control unit, configured to, when the target task is the first task to be executed in the waiting queue corresponding to each environmental value, control a slave thread to obtain the target task from each of the waiting queues, and process the parameters of the target function according to the execution logic in the target task.

[0027] In some embodiments, the slave thread includes a plurality of slave threads, and the control sub-module or the control unit is configured to:

[0028] Determine whether there is an idle slave thread among the plurality of slave threads;

[0029] If there is an idle slave thread among the plurality of slave threads, control the idle slave thread to obtain the target task from each of the waiting queues, and process the parameters of the target function according to the execution logic in the target task.

[0030] In some embodiments, the control sub-module or the control unit is further configured to:

[0031] If there is no idle slave thread among the plurality of slave threads, obtain the current load levels of the plurality of slave threads;

[0032] Determine the slave thread with the lowest load level among the current load levels of the plurality of slave threads as the target slave thread;

[0033] Control the target slave thread to obtain the target task from each of the waiting queues, and process the parameters of the target function according to the execution logic in the target task.

[0034] In some embodiments, the allocation sub-module includes:

[0035] A second determination unit, configured to determine the waiting queue corresponding to each environmental value according to a preset mapping relationship;

[0036] An allocation sub-unit, configured to allocate the target task to the waiting queue.

[0037] In some embodiments, the apparatus further includes:

[0038] A second judgment module, configured to judge whether there is a specified type of function among the function type of the target function and the function types of other functions having the target parameter when the target environment type is the same as the other environment types.

[0039] A second control module, configured to control the slave thread to call the target function and process the target function if there is no specified type of function among the function type of the target function and the function types of other functions having the target parameter.

[0040] In some embodiments, the apparatus further includes:

[0041] A third control module, configured to control the slave thread to call the target function and process the target function when there is no target parameter in the target function that is the same as that in other functions.

[0042] A computer-readable storage medium stores a plurality of instructions adapted to be loaded by a processor to execute the steps in the above data processing method.

[0043] A server includes a memory, a processor, and a computer program stored on the memory and executable on the processor. The processor, when executing the program, implements the steps in the above data processing method.

[0044] In the embodiments of the present application, an operation request is received, and a plurality of candidate functions are determined according to the request type of the operation request; when it is detected that the main thread calls a target function among the plurality of candidate functions, it is judged whether there is a target parameter in the target function that is the same as that in other functions, where the other functions are other functions among the plurality of candidate functions except the target function; when there is a target parameter in the target function that is the same as that in other functions, the target environment type corresponding to the target parameter in the target function is obtained; the other environment type corresponding to the target parameter in other functions is obtained, where the other environment type is the environment type corresponding to the target parameter in candidate functions other than the target function where the target parameter exists; when the target environment type is different from the other environment type, the slave thread is controlled to call the target function and process the target function. In this way, by determining whether there are the same parameters among multiple functions and the environment types corresponding to the same parameters in each function, the target function that does not affect the operation of other functions is separated from the main thread, and the slave thread is controlled to call the target function, thereby reducing the load of the main thread and improving the processing efficiency of the main thread. Description of the Drawings

[0045] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the accompanying drawings required for the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those skilled in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.

[0046] Figure 1a It is a schematic diagram of the scenario of the data processing method provided by the embodiment of the present application.

[0047] Figure 1b It is a schematic flowchart of the data processing method provided by the embodiment of the present application.

[0048] Figure 2 It is another schematic flowchart of the data processing method provided by the embodiment of the present application.

[0049] Figure 3a It is a schematic structural diagram of the data processing device provided by the embodiment of the present application;

[0050] Figure 3b It is another schematic structural diagram of the data processing device provided by the embodiment of the present application;

[0051] Figure 4 It is a schematic structural diagram of the server provided by the embodiment of the present application. Detailed implementation manners

[0052] The following will clearly and completely describe the technical solutions in the embodiments of the present application in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, rather than all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of protection of the present application.

[0053] The embodiments of the present application provide a data processing method, device, and computer-readable storage medium.

[0054] Please refer to Figure 1a , Figure 1aSystem schematic diagram of the data processing system provided by the embodiments of the present application. The system may include at least one client 1000, at least one server 2000, at least one database 3000, and a network 4000. Each application corresponds to at least one server 2000, and the client 1000 may be a terminal device such as a mobile phone, a computer, or a personal digital assistant. The client 1000 can be connected to the server 2000 or multiple servers 2000 through the network 4000. Among them, the network 4000 can be a wireless network or a wired network. For example, the wireless network is a wireless local area network (WLAN), a local area network (LAN), a cellular network, a 2G network, a 3G network, a 4G network, a 5G network, etc. In addition, different clients 1000 can also use their own Bluetooth network or hotspot network to connect to the server 2000, etc. In addition, the system may include a database 3000, and the database 3000 can be used to store user information of users or equipment information, character information, etc. of users in games.

[0055] The embodiments of the present application provide a data processing method, and this method can be executed by the server. As Figure 1a shown, when the server 2000 receives an operation request sent by the client 1000 through the network 4000, it determines multiple candidate functions according to the request type of the operation request; when it detects that the main thread calls the target function among the multiple candidate functions, it determines whether there are target parameters in the target function that are the same as those of other functions, and the other functions are the other functions among the multiple candidate functions except the target function; when there are target parameters in the target function that are the same as those of other functions, it obtains the target environment type corresponding to the target parameter in the target function; it obtains the other environment type corresponding to the target parameter in other functions, and the other environment type is the environment type corresponding to the target parameter in the candidate functions other than the target function where the target parameter exists; when the target environment type is different from the other environment type, it controls the worker thread to call the target function and process the target function. Based on this, by determining whether there are the same parameters between multiple functions and the environment type corresponding to the same parameter in each function, the target function that does not affect the operation of other functions is separated from the main thread, and the worker thread is controlled to call the target function, thereby reducing the load of the main thread and improving the processing efficiency of the main thread.

[0056] It should be noted that Figure 1aThe schematic diagram of the scenario of the data processing system shown is only an example. The data processing system and scenarios described in the embodiments of the present application are used to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those of ordinary skill in the art will know that with the evolution of the data processing system and the emergence of new business scenarios, the technical solutions provided by the embodiments of the present application are equally applicable to similar technical problems.

[0057] In this embodiment, the description will be made from the perspective of the data processing device, which can be specifically integrated in a computer device with a storage unit and a microprocessor installed and having computing capabilities.

[0058] Please refer to Figure 1b , Figure 1b , which is a schematic flowchart of the data processing method provided by the embodiments of the present application. The data processing method includes:

[0059] In step 101, an operation request is received, and multiple candidate functions are determined according to the request type of the operation request.

[0060] Among them, the user's operation behavior on the client can generate various different types of operation requests. For example, clicking on the A control displayed on the client can generate an A-type operation request; clicking on the B control displayed on the client can generate a B-type operation request. The operation request is sent from the client to the server. When the server receives the operation request, it will determine multiple candidate functions to be called according to the request type of the operation request. The multiple candidate functions are used to be calculated or executed to complete the background processing for the operation request.

[0061] Specifically, due to different business types, there are some operations that can be directly performed on the client, that is, there is no need for interaction between the client and the server. The operation requests initiated by the client can be directly responded to and processed on the client, and the client itself can call the functions stored in the client according to different types of operation requests.

[0062] Specifically, the functions required to be called for different types of operation requests are also different. For example, an A-type operation request requires calling two functions, f1() and f2(), and a B-type operation request requires calling two functions, f3() and f4(). Based on different types of operation requests, different functions will be called accordingly, and the corresponding relationship between the function and the request type is preset by the developer during programming.

[0063] In step 102, when it is detected that the main thread calls the target function among the multiple candidate functions, it is determined whether there are the same target parameters in the target function as in other functions.

[0064] Among them, when the main thread calls a function, it calls in a serial manner, that is, multiple functions are called by the main thread in a certain order. The target function is the function that needs to be called by the main program among multiple candidate functions. The way to detect whether the main thread is about to call the target function among multiple candidate functions can be to determine whether the function called by the main thread has been processed. If it has been processed, it is determined that the main thread is about to call the function among multiple candidate functions. The target function is the function that needs to be called for the first time currently among multiple candidate functions after the main thread calls other functions according to the specified call order of multiple candidate functions, and this function is determined as the target function. When a program starts, a process is created by the operating system (OS), and at the same time a thread starts running immediately. Because it starts executing when the program starts, if you need to create another thread, the newly created thread is a subordinate thread of this main thread. Each process has at least one main thread.

[0065] Specifically, other functions are the other functions among the multiple candidate functions except the target function. There are cases where parameters are shared among different functions. For example, in the functions f1(a, b) and f2(a, c), it can be seen that the functions f1 and f2 share the parameter a, so the parameter a is the target parameter.

[0066] In step 103, when there is a target parameter in the target function that is the same as that in other functions, obtain the target environment type corresponding to the target parameter in the target function.

[0067] Among them, in scripting languages used in programming such as Python, LISP, and Lua, although multiple functions share a target parameter, there are also cases where multiple functions share a target parameter due to parameter name conflicts during coding. In scripting languages, to solve this problem, the parameters are defined in different environment tables, that is, each parameter is marked with an environment type, and the content of the mark is the name of the environment table. For example, in the function f1(a, b), the parameter values corresponding to the parameters a and b are stored in the environment table named F1_ENV, so the environment types corresponding to the parameters a and b are F1_ENV, and the parameter values corresponding to each parameter are stored in the environment table named F1_ENV, so that each parameter corresponds to different environment values under different environment tables or environment types. Therefore, when there is a target function, it is necessary to obtain the target environment type corresponding to the target parameter in the target function.

[0068] Specifically, the environment type corresponding to the parameter in each function can be obtained through the function processing module. The main internal logic of the function processing module is as follows: Replace the parameters in all functions in the code with ENVn.x, where ENVn is the environment table where the parameter x is located. Therefore, the target environment type corresponding to the target parameter in the target function can be obtained through the function processing module.

[0069] For example,

[0070] x = 1

[0071] z = 2

[0072] def foo1(x,y):

[0073] return x+y+z

[0074] Obtain the environment type corresponding to each parameter in the foo1 function through the function processing module, and the above code has been compiled into

[0075] GLOBAL.x = 1;

[0076] GLOBAL.z = 2;

[0077] def foo(FOO1_ENV.x,FOO1_ENV.y);

[0078] return FOO1_ENV.x+FOO1_ENV.y+GLOBAL.z

[0079] Thus, the parameter x and the parameter y in the foo1 function belong to the FOO1_ENV environment table, that is, the parameter x and the parameter z outside the foo1 function are local variables, and their environment type is GLOBAL. Different environment tables have an inclusion relationship. For example, GLOBAL and FOO1_ENV. Since the foo function is defined in GLOBAL, the environment table FOO1_ENV of foo is included in GLOBAL; therefore, the function processing module first looks for the parameters x and z in FOO1_ENV. If found, use them; otherwise, continue to look in the upper layer that contains FOO1_ENV, that is, GLOBAL. For example, for the variable z, it does not exist in FOO1_ENV, so continue to look up in GLOBAL and find GLOBAL.z, so z uses this environment value; if it cannot be found in the upper layer, continue to look up in the upper layer in this layer-by-layer search manner.

[0080] In step 104, obtain the other environment type corresponding to the target parameter in other functions.

[0081] Among them, in order to determine whether the environment types corresponding to the target parameters in the objective function and other functions are the same, after step 103, it is also necessary to obtain, through the function processing module, the other environment types corresponding to the target parameters in other functions, where the other environment types are the environment types corresponding to the target parameters in the candidate functions other than the objective function that have the target parameters.

[0082] In step 105, when the target environment type is different from the other environment types, control the slave thread to call the objective function and process the objective function.

[0083] Among them, by comparing the target environment type with the other environment types, it is determined that when the target environment type is different from the other environment types, it proves that the functions with the target parameters only have the same name for the target parameters, but in fact the accessed parameters are not the same. Therefore, the objective function can be separated from the main thread, and the slave thread is controlled to call the objective function and process the objective function.

[0084] In some embodiments, the step of controlling the slave thread to call the objective function and process the objective function when the target environment type is different from the other environment types includes:

[0085] (1) When the target environment type is different from the other environment types, encapsulate the objective function into a target task, where the target task includes the parameters required to execute the objective function and the execution logic between the parameters;

[0086] (2) Obtain the environment type corresponding to each parameter in the objective function and determine the environment value corresponding to each parameter under the environment type;

[0087] (3) Allocate the target task to the waiting queue corresponding to each environment value;

[0088] (4) Control the slave thread to obtain the target task from each waiting queue and process the parameters of the objective function according to the execution logic in the target task.

[0089] Among them, the way to separate the target function from the main thread is as follows: encapsulate the target function into a target task, where the target task contains the execution logic among the parameters of the target function and the parameters required to execute this execution logic. Obtain the environment type corresponding to each parameter in the target function through the function processing module, and determine the environment value corresponding to each parameter under the environment type. And since when a function is called, the function is not directly executed, but enters the waiting queue according to the environment value corresponding to each parameter in the function under its respective environment type, the target task is respectively assigned to the waiting queue corresponding to each environment value, so as to control the worker thread to obtain the target task from each such waiting queue, and process the parameters of the target function according to the execution logic in the target task.

[0090] For example, encapsulate the function foo(x, y) to obtain the task foo. After being processed by the function processing module, the environment type corresponding to the parameter x is FOO_ENV, and the environment type corresponding to the parameter y is also FOO_ENV. Then the parameter value corresponding to the parameter x under the FOO_ENV type is FOO_ENV.x, and the parameter value corresponding to the parameter y under the FOO_ENV type is FOO_ENV.y. Assign the task foo to the waiting queues corresponding to FOO_ENV.x and FOO_ENV.y, and control the worker thread to obtain the task foo from the waiting queues corresponding to FOO_ENV.x and FOO_ENV.y, and perform calculations according to the parameters and execution logic in the task foo.

[0091] In some embodiments, the step of controlling the worker thread to obtain the target task from the waiting queue and process the parameters of the target function according to the execution logic in the target task includes:

[0092] (1.1) Determine whether the target task is the first task to be executed in the waiting queue corresponding to each environment value;

[0093] (1.2) When the target task is the first task to be executed in the waiting queue corresponding to each environment value, control the worker thread to obtain the target task from each such waiting queue, and process the parameters of the target function according to the execution logic in the target task.

[0094] Among them, since when a function is called, each parameter must be found in the waiting queue at the same time, so as to perform calculations and output results according to the found parameters. Therefore, when the worker thread calls the target function, it is necessary to determine whether the target task is the first task to be executed in the waiting queue corresponding to each environment value. If so, control the worker thread to take out the target task from each waiting queue, and then process the parameters of the target function according to the execution logic in the target task.

[0095] In some embodiments, the slave threads include multiple slave threads. The step of the control slave thread obtaining the target task from each of the waiting queues and processing the parameters of the target function according to the execution logic in the target task includes:

[0096] (1.1) Determine whether there are idle slave threads among the multiple slave threads;

[0097] (1.2) If there are idle slave threads among the multiple slave threads, control the idle slave threads to obtain the target task from each of the waiting queues and process the parameters of the target function according to the execution logic in the target task.

[0098] Among them, to ensure that the user can get the feedback from the server as soon as possible after making an operation request, it is necessary to control the target function separated from the main thread to be called by the slave threads as soon as possible. The way to control the slave threads to call the target function as soon as possible can be: determine whether there are slave threads in an idle state among the multiple slave threads. If there are slave threads in an idle state among the multiple slave threads, the idle slave threads can be controlled to call the target function, that is, control the idle slave threads to obtain the target task from each waiting queue and process the parameters of the target function according to the execution logic in the target task.

[0099] Specifically, an idle slave thread is a thread on which there are no other tasks. That is, after allocating the task to the idle slave thread, the idle slave thread can immediately process the task.

[0100] In some embodiments, the method further includes:

[0101] (1.1) If there are no idle slave threads among the multiple slave threads, obtain the current load level of the multiple slave threads;

[0102] (1.2) Determine the slave thread with the lowest load level among the current load levels of the multiple slave threads as the target slave thread;

[0103] (1.3) Control the target slave thread to obtain the target task from each of the waiting queues and process the parameters of the target function according to the execution logic in the target task.

[0104] Among them, if there are no idle slave threads among the multiple slave threads, determine the current load level of each slave thread, and determine the target slave thread with the lowest load level from the multiple slave threads. The lowest load level indicates that the target slave thread can complete other tasks as soon as possible, thus having the ability to process the target task. Then control the target slave thread to obtain the target task from each of the waiting queues and process the parameters of the target function according to the execution logic in the target task.

[0105] Specifically, the load level can be divided into multiple levels, such as busy, moderate, and idle. The load level of each slave thread can be determined according to the task currently being executed by each slave thread, and the slave thread with the lowest load level is determined as the target slave thread. Specifically, when there is no idle slave thread, the slave thread in the moderate state can be determined as the target slave thread.

[0106] In some embodiments, the step of allocating the target task to the waiting queue corresponding to each environment value includes:

[0107] (1.1) Determine the waiting queue corresponding to each environment value according to the preset mapping relationship;

[0108] (1.2) Allocate the target task to the waiting queue.

[0109] Wherein, each environment value corresponds to a waiting queue, and the mapping relationship between the environment value and the waiting queue can be determined by a pre-set method. It can also be dynamically generated during the running process when a certain environment value is first accessed, and this is not limited here.

[0110] In some embodiments, the method further includes:

[0111] (1) When the target environment type is the same as the other environment types, determine whether there is a specified type of function among the function type of the target function and the function types of the other functions having the target parameter;

[0112] (2) If there is no specified type of function among the function type of the target function and the function types of the other functions having the target parameter, control the slave thread to call the target function and process the target function.

[0113] Wherein, if two or more functions share the same parameter, it proves that there is an association between these functions, such as a mutually dependent relationship. Then, the functions having the common target parameter cannot be separated from the main thread. If they are separated and allocated to the slave thread for calling, it will cause the problem of parameter value confusion. However, for some functions without a specified function type, even if the parameters accessed by multiple functions and the environment types corresponding to the parameters are the same, the functions can still be separated from the main thread. For the specified function type, the function cannot be separated from the main thread. The specified function type means that when calling the target function and other functions having the target parameter, a change in the call order will cause a change in the parameter value corresponding to the target parameter.

[0114] For example,

[0115] x = 1

[0116] z = 2

[0117] def foo1(x, y):

[0118] return x + y + z

[0119] def foo2(x, y):

[0120] z = z + 1

[0121] return x + y + z

[0122] Specifically, the foo1 function and the foo2 function have the same parameter z. If x is set to 1 and y is set to 2, and the foo1 function is called first and then the foo2 function, the value returned by the foo1 function is 1 + 2 + 2 = 5, and the value returned by the foo2 function is 1 + 2 + 3 = 6. If the foo2 function is called first and then the foo1 function, the value returned by the foo2 function is 1 + 2 + 3 = 6, and the value returned by the foo1 function is 1 + 2 + 3 = 6. Due to the assignment-type function z = z + 1, the calculation results are different depending on the call order. Therefore, when there is an assignment-type function, the function cannot be separated from the main thread. When there is no specified type of function in the target function and other functions with target parameters, the target function can be called from a thread and processed.

[0123] In some embodiments, the method further includes:

[0124] (1) When there are no target parameters in the target function that are the same as those in other functions, control the slave thread to call the target function and process the target function.

[0125] Among them, when there are no target parameters in the target function that are the same as those in other functions, it means that each parameter in the target function has not been accessed by other functions. Therefore, the target function can be directly separated from the main thread, and the slave thread can be controlled to call the target function and process the target function.

[0126] As can be seen from the above, in the embodiment of the present application, an operation request is received, and multiple candidate functions are determined according to the request type of the operation request; when it is detected that the main thread calls a target function among the multiple candidate functions, it is determined whether there is a target parameter in the target function that is the same as that in other functions, where the other functions are the other functions among the multiple candidate functions except the target function; when there is a target parameter in the target function that is the same as that in other functions, the target environment type corresponding to the target parameter in the target function is obtained; the other environment type corresponding to the target parameter in other functions is obtained, where the other environment type is the environment type corresponding to the target parameter in the candidate functions other than the target function in which the target parameter exists; when the target environment type is different from the other environment type, the slave thread is controlled to call the target function and process the target function. In this way, by determining whether there are the same parameters among multiple functions and the environment type corresponding to the same parameter in each function, the target function that does not affect the operation of other functions is separated from the main thread, and the slave thread is controlled to call the target function, thereby reducing the load of the main thread and improving the processing efficiency of the main thread.

[0127] Combined with the method described in the above embodiments, the following will give further detailed examples.

[0128] Please refer to Figure 2 , Figure 2 which is another schematic flowchart of the data processing method provided by the embodiment of the present application. The method flow may include:

[0129] In step 201, the server receives an operation request and determines multiple candidate functions according to the request type of the operation request.

[0130] Among them, a user's operation behavior on the client can generate various types of operation requests. For example, clicking on the A control displayed on the client can generate an A-type operation request; clicking on the B control displayed on the client can generate a B-type operation request. The operation request is sent from the client to the server. When the server receives the operation request, it will determine multiple candidate functions to be called according to the request type of the operation request. The multiple candidate functions are used to be calculated or executed to complete the background processing for the operation request.

[0131] Specifically, the functions required to be called for different types of operation requests are also different. For example, an A-type operation request requires calling two functions, f1() and f2(), and a B-type operation request requires calling two functions, f3() and f4(). Based on different types of operation requests, different functions will be called correspondingly, and the correspondence between the function and the request type is preset by developers during programming.

[0132] In step 202, when the server detects that the main thread calls the target function among multiple candidate functions, it determines whether there is a target parameter in the target function that is the same as that in other functions.

[0133] whether there is a target parameter in the function that is the same as that in other functions.

[0134] Among them, when the main thread calls a function, it is called in a serial manner, that is, multiple functions are called by the main thread in a certain order, and the target function is the function that needs to be called by the main program among multiple candidate functions. The way to detect whether the main thread is about to call the target function among multiple candidate functions can be to determine whether the function called by the main thread has been processed. If it has been processed, it is determined that the main thread is about to call the target function among multiple candidate functions. When a program starts, a process is created by the operating system (OS), and at the same time a thread runs immediately. Because it is executed at the beginning of the program, if you need to create another thread, the newly created thread is a subordinate thread of this main thread. Each process has at least one main thread.

[0135] Specifically, other functions are the other functions among the multiple candidate functions except the target function. There are cases where parameters are shared among different functions. For example, in the functions f1(a, b) and f2(a, c), it can be seen that the functions f1 and f2 share the parameter a, so the parameter a is the target parameter.

[0136] In step 203, when there is a target parameter in the target function that is the same as that in other functions, the server obtains the target environment type corresponding to the target parameter in the target function.

[0137] Among them, in scripting languages such as Python, LISP, and Lua used for programming, although multiple functions share a target parameter, the target parameter may also be caused by parameter name conflicts during coding. In scripting languages, to solve this problem, the parameters are defined in different environment tables, that is, each parameter is marked with an environment type, so that each parameter has different environment values corresponding to different environment tables or environment types. The content of the mark is the name of the environment table. For example, in the function f1(a, b), the parameter values corresponding to the parameters a and b are stored in the environment table named F1_ENV, so the environment types corresponding to the parameters a and b are F1_ENV. The parameter values corresponding to each parameter are stored in the environment table named F1_ENV. Therefore, when there is a target function, it is necessary to obtain the target environment type corresponding to the target parameter in the target function.

[0138] Specifically, the environment type corresponding to the parameter in each function can be obtained through the function processing module. The main internal logic of the function processing module is as follows: Replace the parameters in all functions in the code with ENVn.x, where ENVn is the environment table where the parameter x is located. Therefore, the target environment type corresponding to the target parameter in the target function can be obtained through the function processing module.

[0139] In step 204, the server obtains the other environment types corresponding to the target parameter in other functions.

[0140] Among them, in order to determine whether the environment types corresponding to the target parameter in the target function and other functions are the same, after step 203, it is also necessary to obtain the other environment types corresponding to the target parameter in other functions through the function processing module. The other environment type is the environment type corresponding to the target parameter in other candidate functions that have the target parameter except the target function.

[0141] In step 205, when the target environment type is different from the other environment types, the server encapsulates the target function into a target task.

[0142] Among them, the way to separate the target function from the main thread is: encapsulate the target function into a target task, and the target task contains the execution logic between the parameters of the target function and the parameters required to execute this execution logic.

[0143] For example, encapsulate the foo(x,y) function to obtain the task foo.

[0144] In step 206, the server obtains the environment type corresponding to each parameter in the target function and determines the environment value corresponding to each parameter under the environment type.

[0145] For example, after the foo(x,y) function is processed by the function processing module, the environment type corresponding to the parameter x is FOO_ENV, and the environment type corresponding to the parameter y is also FOO_ENV. Then the parameter value corresponding to the parameter x under the FOO_ENV type is FOO_ENV.x, and the parameter value corresponding to the parameter y under the FOO_ENV type is FOO_ENV.y.

[0146] In step 207, the server determines the waiting queue corresponding to each environment value according to the preset mapping relationship.

[0147] Among them, each environment value corresponds to a waiting queue, and the mapping relationship between the environment value and the waiting queue can be determined by a pre-set method. It can also be dynamically generated during the running process when a certain environment value is accessed for the first time. There is no limitation here.

[0148] In step 208, the server allocates the target task to the waiting queue.

[0149] Among them, when a function is called, the function does not execute directly. Instead, it enters the waiting queue according to the environment values corresponding to each parameter in the function under their respective environment types. Therefore, the target tasks are respectively assigned to the waiting queues corresponding to each environment value.

[0150] For example, the task foo is assigned to the waiting queues corresponding to FOO_ENV.x and FOO_ENV.y.

[0151] In step 209, the server determines whether the target task is the first task to be executed in the waiting queue corresponding to each environment value.

[0152] Among them, when a function is called, it is necessary to be able to find each parameter from the waiting queue at the same time, so as to calculate and output the result according to the found parameters. Therefore, when calling the target function from a thread, it is necessary to determine whether the target task is the first task to be executed in the waiting queue corresponding to each environment value.

[0153] In step 210, when the target task is the first task to be executed in the waiting queue corresponding to each environment value, the server determines whether there is an idle slave thread among multiple slave threads.

[0154] Among them, if the target task is the first task to be executed in the waiting queue corresponding to each environment value, then control the slave thread to take out the target task from each waiting queue, and then process the parameters of the target function according to the execution logic in the target task.

[0155] Specifically, to ensure that the user can get the feedback from the server as soon as possible after making an operation request, it is necessary to control the target function separated from the main thread to be called by the slave thread as soon as possible.

[0156] In step 211, if there is an idle slave thread among multiple slave threads, the server controls the idle slave thread to obtain the target task from each waiting queue and processes the parameters of the target function according to the execution logic in the target task.

[0157] Among them, the way to control the slave thread to call the target function as soon as possible can be: determine whether there is a slave thread in an idle state among multiple slave threads. If there is a slave thread in an idle state among multiple slave threads, then control the idle slave thread to call the target function, that is, control the idle slave thread to obtain the target task from each waiting queue and process the parameters of the target function according to the execution logic in the target task.

[0158] In step 212, if there is no idle slave thread among multiple slave threads, the server obtains the current load levels of multiple slave threads.

[0159] Among them, if there is no idle slave thread among multiple slave threads, the current load levels of multiple slave threads can be obtained.

[0160] Specifically, the load levels can be divided into levels, specifically divided into multiple load levels such as busy and moderate, and the load level of each slave thread can be determined according to the tasks currently being executed by each slave thread.

[0161] In step 213, the server determines the slave thread with the lowest load level among the current load levels of multiple slave threads as the target slave thread.

[0162] Among them, the lowest load level indicates that the target slave thread can process other tasks as soon as possible and then process the target task. The load level of each slave thread can be determined according to the tasks currently being executed by each slave thread, and the slave thread with the lowest load level is determined as the target slave thread.

[0163] In step 214, the server controls the target slave thread to obtain the target task from each waiting queue and processes the parameters of the target function according to the execution logic in the target task.

[0164] Among them, when the slave thread with the lowest load level is determined as the target slave thread, the target slave thread is controlled to obtain the target task from each waiting queue and processes the parameters of the target function according to the execution logic in the target task.

[0165] As can be seen from the above, in the embodiment of the present application, by receiving an operation request, multiple candidate functions are determined according to the request type of the operation request; when it is detected that the main thread calls the target function among the multiple candidate functions, it is judged whether there are target parameters in the target function that are the same as those in other functions, and the other functions are the other functions among the multiple candidate functions except the target function; when there are target parameters in the target function that are the same as those in other functions, the target environment type corresponding to the target parameter in the target function is obtained; the other environment type corresponding to the target parameter in other functions is obtained, and the other environment type is the environment type corresponding to the target parameter in the candidate functions other than the target function where the target parameter exists; when the target environment type is different from the other environment type, the slave thread is controlled to call the target function and process the target function. In this way, by determining whether there are the same parameters among multiple functions and the environment type corresponding to the same parameter in each function, the target function that does not affect the operation of other functions is separated from the main thread, and the slave thread is controlled to call the target function, thereby reducing the load of the main thread and improving the processing efficiency of the main thread.

[0166] To facilitate better implementation of the data processing method provided in the embodiments of the present application, the embodiments of the present application further provide an apparatus based on the above data processing method. The meanings of the nouns are the same as those in the above data processing method, and the specific implementation details can be referred to the description in the method embodiments.

[0167] Please refer to Figure 3a and Figure 3b , Figure 3a , which is a schematic structural diagram of the data processing apparatus provided in the embodiments of the present application. Figure 3b , which is another schematic structural diagram of the data processing apparatus provided in the embodiments of the present application. The data processing apparatus may include a determination module 301, a first judgment module 302, a first acquisition module 303, a second acquisition module 304, a first control module 305, etc.

[0168] The determination module 301 is configured to receive an operation request and determine a plurality of candidate functions according to the request type of the operation request.

[0169] The first judgment module 302 is configured to, when detecting that the main thread calls a target function among the plurality of candidate functions, judge whether there are target parameters in the target function that are the same as those in other functions, where the other functions are other functions among the plurality of candidate functions except the target function.

[0170] The first acquisition module 303 is configured to, when there are target parameters in the target function that are the same as those in other functions, acquire the target environment type corresponding to the target parameters in the target function.

[0171] The second acquisition module 304 is configured to acquire the other environment type corresponding to the target parameters in other functions, where the other environment type is the environment type corresponding to the target parameters in candidate functions other than the target function where the target parameters exist.

[0172] The first control module 305 is configured to, when the target environment type is different from the other environment type, control the slave thread to call the target function and process the target function.

[0173] In some embodiments, the first control module 305 includes:

[0174] The encapsulation sub-module 3051 is configured to, when the target environment type is different from the other environment type, encapsulate the target function into a target task, where the target task includes the parameters required to execute the target function and the execution logic between the parameters.

[0175] The determination sub-module 3052 is configured to acquire the environment type corresponding to each parameter in the target function and determine the environment value corresponding to each parameter under the environment type.

[0176] An allocation sub-module 3053 for allocating the target task to the waiting queue corresponding to each environmental value;

[0177] A control sub-module 3054 for controlling the slave threads to obtain the target task from each of the waiting queues and process the parameters of the target function according to the execution logic in the target task.

[0178] In some embodiments, the control sub-module 3054 includes:

[0179] A first determination unit for determining whether the target task is the first task to be executed in the waiting queue corresponding to each environmental value;

[0180] A control unit for controlling the slave threads to obtain the target task from each of the waiting queues and process the parameters of the target function according to the execution logic in the target task when the target task is the first task to be executed in the waiting queue corresponding to each environmental value.

[0181] In some embodiments, the slave threads include multiple slave threads, and the control sub-module 3054 or the control unit is used for:

[0182] Judging whether there are idle slave threads among the multiple slave threads;

[0183] If there are idle slave threads among the multiple slave threads, controlling the idle slave threads to obtain the target task from each of the waiting queues and process the parameters of the target function according to the execution logic in the target task.

[0184] In some embodiments, the control sub-module 3054 or the control unit is further used for:

[0185] If there are no idle slave threads among the multiple slave threads, obtaining the current load levels of the multiple slave threads;

[0186] Determining the slave thread with the lowest load level among the current load levels of the multiple slave threads as the target slave thread;

[0187] Controlling the target slave thread to obtain the target task from each of the waiting queues and process the parameters of the target function according to the execution logic in the target task.

[0188] In some embodiments, the allocation sub-module 3053 includes:

[0189] A second determination unit for determining the waiting queue corresponding to each environmental value according to a preset mapping relationship;

[0190] An allocation sub-unit for allocating the target task to the waiting queue.

[0191] In some embodiments, the apparatus further includes:

[0192] A second determination module 306, configured to determine whether there is a specified type of function among the function type of the target function and the function types of other functions having the target parameter when the target environment type is the same as the other environment types;

[0193] A second control module 307, configured to control the slave thread to call the target function and process the target function if there is no specified type of function among the function type of the target function and the function types of other functions having the target parameter.

[0194] In some embodiments, the apparatus further includes:

[0195] A third control module 308, configured to control the slave thread to call the target function and process the target function when there is no target parameter in the target function that is the same as that in other functions.

[0196] As can be seen from the above, in the embodiment of the present application, the first determination module 301 receives an operation request, and determines a plurality of candidate functions according to the request type of the operation request; when the determination module 302 detects that the main thread calls a target function among the plurality of candidate functions, it determines whether there is a target parameter in the target function that is the same as that in other functions, where the other functions are other functions among the plurality of candidate functions except the target function; when there is a target parameter in the target function that is the same as that in other functions, the first acquisition module 303 acquires the target environment type corresponding to the target parameter in the target function; the second acquisition module 304 acquires the other environment type corresponding to the target parameter in other functions, where the other environment type is the environment type corresponding to the target parameter in candidate functions other than the target function that have the target parameter; when the target environment type is different from the other environment type, the first control module 305 controls the slave thread to call the target function and process the target function. In this way, by determining whether there are the same parameters among a plurality of functions and the environment types corresponding to the same parameters in each function, the target function that does not affect the operation of other functions is separated from the main thread, and the slave thread is controlled to call the target function, thereby reducing the load of the main thread and improving the processing efficiency of the main thread.

[0197] For the specific implementation of each of the above operations, reference may be made to the previous embodiments, which will not be elaborated herein.

[0198] Correspondingly, the embodiment of the present application further provides a server, as Figure 4 shown Figure 4Schematic diagram of the structure of the server provided by the embodiment of the present application. The server 2000 includes a processor 401 having one or more processing cores, a memory 402 having one or more computer-readable storage media, and a computer program stored in the memory 402 and executable on the processor. Among them, the processor 401 is electrically connected to the memory 402. Those skilled in the art can understand that the server structure shown in the figure does not constitute a limitation on the server, and it may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0199] The processor 401 is the control center of the server 2000, connecting various parts of the entire server 2000 through various interfaces and lines. By running or loading software programs and / or modules stored in the memory 402, and calling data stored in the memory 402, it executes various functions of the server 2000 and processes data, thereby monitoring the server 2000 as a whole.

[0200] In the embodiment of the present application, the processor 401 in the server 2000 will load the instructions corresponding to the processes of one or more application programs into the memory 402 according to the following steps, and the processor 401 will run the application programs stored in the memory 402 to implement various functions:

[0201] Receive an operation request, and determine a plurality of candidate functions according to the request type of the operation request; when it is detected that the main thread calls the target function among the plurality of candidate functions, determine whether there are target parameters in the target function that are the same as those of other functions, where the other functions are the other functions among the plurality of candidate functions except the target function; when there are target parameters in the target function that are the same as those of other functions, obtain the target environment type corresponding to the target parameter in the target function; obtain the other environment type corresponding to the target parameter in other functions, where the other environment type is the environment type corresponding to the target parameter in the candidate functions other than the target function where the target parameter exists; when the target environment type is different from the other environment type, control the slave thread to call the target function and process the target function.

[0202] For the specific implementation of each of the above operations, reference can be made to the previous embodiments, and details will not be repeated here.

[0203] Optionally, as Figure 4 shown, the server 2000 further includes: an input unit 403 and a power supply 404. Among them, the processor 401 is electrically connected to the input unit 403 and the power supply 404 respectively. Those skilled in the art can understand, Figure 4The server structure shown does not constitute a limitation on the server, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0204] The input unit 403 can be used to receive input digital, character information or user feature information (such as fingerprint, iris, face information, etc.), and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.

[0205] The power supply 404 is used to supply power to each component of the server 2000. Optionally, the power supply 404 can be logically connected to the processor 401 through a power management system, so as to realize functions such as management of charging, discharging, and power consumption management through the power management system. The power supply 404 can also include any components such as one or more DC or AC power supplies, a recharge system, a power failure detection circuit, a power converter or inverter, and a power status indicator.

[0206] Although Figure 4 not shown in the figure, the server 2000 may also include a camera, a sensor, a Wi-Fi module, a Bluetooth module, etc., which will not be elaborated here.

[0207] In the above embodiments, the descriptions of each embodiment have their own emphases. For parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0208] As can be seen from the above, the server provided in this embodiment can receive an operation request, determine a plurality of candidate functions according to the request type of the operation request; when it is detected that the main thread calls a target function among the plurality of candidate functions, determine whether there are target parameters in the target function that are the same as those of other functions, and the other functions are other functions among the plurality of candidate functions except the target function; when there are target parameters in the target function that are the same as those of other functions, obtain the target environment type corresponding to the target parameter in the target function; obtain the other environment type corresponding to the target parameter in other functions, and the other environment type is the environment type corresponding to the target parameter in candidate functions other than the target function where the target parameter exists; when the target environment type is different from the other environment type, control the worker thread to call the target function and process the target function. In this way, by determining whether there are the same parameters among multiple functions, and the environment types corresponding to the same parameters in each function, the target function that does not affect the operation of other functions is separated from the main thread, and the worker thread is controlled to call the target function, thereby reducing the load of the main thread and improving the processing efficiency of the main thread.

[0209] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions or by controlling relevant hardware through instructions. The instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0210] For this reason, an embodiment of the present application provides a computer-readable storage medium, in which multiple computer programs are stored. The computer programs can be loaded by a processor to execute the steps in any one of the data processing methods provided by the embodiments of the present application. For example, the computer program can execute the following steps:

[0211] Receive an operation request, and determine a plurality of candidate functions according to the request type of the operation request; when it is detected that the main thread calls a target function among the plurality of candidate functions, determine whether there are target parameters in the target function that are the same as those of other functions, where the other functions are other functions among the plurality of candidate functions except the target function; when there are target parameters in the target function that are the same as those of other functions, obtain the target environment type corresponding to the target parameter in the target function; obtain the other environment type corresponding to the target parameter in the other functions, where the other environment type is the environment type corresponding to the target parameter in candidate functions other than the target function that have the target parameter; when the target environment type is different from the other environment type, control the slave thread to call the target function and process the target function.

[0212] For the specific implementation of each of the above operations, reference can be made to the previous embodiments, and details are not described herein again.

[0213] Among them, the storage medium may include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk, etc.

[0214] Since the computer programs stored in the storage medium can execute the steps in any one of the data processing methods provided by the embodiments of the present application, the beneficial effects that can be achieved by any one of the data processing methods provided by the embodiments of the present application can be realized. For details, refer to the previous embodiments, and details are not described herein again.

[0215] The above has introduced in detail a data processing method, device, computer-readable storage medium, and server provided by the embodiments of the present application. Specific examples are used in this article to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present application.

Claims

1. A data processing method, characterized in that, it includes: Receiving an operation request, and determining multiple candidate functions according to the request type of the operation request; When it is detected that the main thread calls a target function among the multiple candidate functions, determining whether there are target parameters in the target function that are the same as those of other functions, where the other functions are other functions among the multiple candidate functions except the target function; When there are target parameters in the target function that are the same as those of other functions, obtaining the target environment type corresponding to the target parameters in the target function; Obtaining the other environment type corresponding to the target parameters in other functions, where the other environment type is the environment type corresponding to the target parameters in candidate functions other than the target function where the target parameters exist; When the target environment type is different from the other environment type, controlling a slave thread to call the target function and process the target function.

2. The data processing method according to claim 1, characterized in that, The step of, when the target environment type is different from the other environment type, controlling a slave thread to call the target function and process the target function includes: When the target environment type is different from the other environment type, encapsulating the target function into a target task, where the target task includes the parameters required to execute the target function and the execution logic between the parameters; Obtaining the environment type corresponding to each parameter in the target function, and determining the environment value corresponding to each parameter under the environment type; Allocating the target task to the waiting queue corresponding to each environment value; Controlling a slave thread to obtain the target task from each waiting queue, and processing the parameters of the target function according to the execution logic in the target task.

3. The data processing method according to claim 2, characterized in that, The step of, controlling a slave thread to obtain the target task from the waiting queue and processing the parameters of the target function according to the execution logic in the target task includes: Determining whether the target task is the first task to be executed in the waiting queue corresponding to each environment value; When the target task is the first task to be executed in the waiting queue corresponding to each environment value, controlling a slave thread to obtain the target task from each waiting queue, and processing the parameters of the target function according to the execution logic in the target task.

4. The data processing method according to any one of claims 2 or 3, characterized in that, The slave thread includes multiple slave threads, and the step of, controlling a slave thread to obtain the target task from each waiting queue and processing the parameters of the target function according to the execution logic in the target task includes: Determining whether there is an idle slave thread among the multiple slave threads; If there is an idle slave thread among the multiple slave threads, controlling the idle slave thread to obtain the target task from each waiting queue, and processing the parameters of the target function according to the execution logic in the target task.

5. The data processing method according to claim 4, wherein, the method further includes: if there is no idle slave thread among the multiple slave threads, obtaining the current load level of the multiple slave threads; determining the slave thread with the lowest load level among the current load levels of the multiple slave threads as the target slave thread; controlling the target slave thread to obtain the target task from each of the waiting queues, and processing the parameters of the target function according to the execution logic in the target task.

6. The data processing method according to claim 2, wherein, the step of allocating the target task to the waiting queue corresponding to each environment value includes: determining the waiting queue corresponding to each environment value according to a preset mapping relationship; allocating the target task to the waiting queue.

7. The data processing method according to claim 1, wherein, the method further includes: when the target environment type is the same as the other environment types, determining whether there is a specified type function among the function type of the target function and the function types of other functions having the target parameter; if there is no specified type function among the function type of the target function and the function types of other functions having the target parameter, controlling the slave thread to call the target function and process the target function.

8. The data processing method according to claim 1, wherein, the method further includes: when there is no target parameter in the target function that is the same as that in other functions, controlling the slave thread to call the target function and process the target function.

9. A data processing device, wherein, it includes: a determination module, configured to receive an operation request and determine multiple candidate functions according to the request type of the operation request; a first judgment module, configured to, when detecting that the main thread calls a target function among the multiple candidate functions, judge whether there is a target parameter in the target function that is the same as that in other functions, where the other functions are other functions among the multiple candidate functions except the target function; a first acquisition module, configured to, when there is a target parameter in the target function that is the same as that in other functions, acquire the target environment type corresponding to the target parameter in the target function; a second acquisition module, configured to acquire the other environment type corresponding to the target parameter in other functions, where the other environment type is the environment type corresponding to the target parameter in candidate functions other than the target function that have the target parameter; a first control module, configured to, when the target environment type is different from the other environment types, control the slave thread to call the target function and process the target function.

10. A computer-readable storage medium, wherein, the computer-readable storage medium stores multiple instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the data processing method according to any one of claims 1 to 8.

11. A server, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein, When the processor executes the program, it implements the steps in the data processing method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Remote procedure call method and apparatus, and computer device

    CN107277029A

  • Thread based message processing method, intelligent device and storage medium

    CN107818023A