Method and device for calling remote procedure in synchronous mode
A remote procedure call and remote procedure technology, applied in the field of remote procedure call in a synchronous manner, can solve the problems of waste of system resources, reduce program performance, etc., and achieve the effect of reducing waste of system resources
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0060] Such as figure 1 As shown, this embodiment provides a method for performing remote procedure calls in a synchronous manner, including:
[0061] Step S101: When calling a remote procedure, create a signal event corresponding to the remote procedure, the initial state of the signal event is no signal state.
[0062] As an optional implementation manner, step S101 includes:
[0063] Call the CreateEvent function to create a signal event corresponding to the remote process; assign a unique identifier to the signal event, and store the signal event and the unique identifier in a dictionary Dict, and the unique identifier is the same as the Signal event correspondence.
[0064] In a specific implementation process, the caller can call one or more remote procedures at the same time, specifically by calling the RpcCallProcedure function to call the remote procedure. When calling a remote procedure, the CreateEvent function can be called to create a signal event (Event) corre...
Embodiment 2
[0093] Based on the same inventive concept, this embodiment provides an apparatus 200 for performing remote procedure calls in a synchronous manner, such as figure 2 shown, including:
[0094] The creating unit 201 is configured to create a signal event corresponding to the remote process when the remote process is called, and the initial state of the signal event is a no-signal state;
[0095] a sending unit 202, configured to send a calling request required for calling the remote procedure to the called end of the remote procedure;
[0096] The calling unit 203 is used to call a preset function to suspend the thread corresponding to the remote process, and wait for the request result returned by the called end;
[0097] The changing unit 204 is configured to change the state of the signal event to a signaled state when the request result is received, so that the preset function wakes up the thread corresponding to the remote process.
[0098]As an optional implementation ...
Embodiment 3
[0115] Based on the same inventive idea, such as image 3 As shown, the present embodiment provides a device 300 for performing remote procedure calls in a synchronous manner, including a memory 310, a processor 320, and a computer program 311 stored in the memory 310 and operable on the processor 320, and the processor 320 The following steps are implemented when the computer program 311 is executed:
[0116] When the remote procedure is called, a signal event corresponding to the remote procedure is created, and the initial state of the signal event is a no-signal state;
[0117] Sending an invocation request required for invoking the remote procedure to the called end of the remote procedure;
[0118] calling a preset function to suspend the thread corresponding to the remote process, and waiting for the request result returned by the called end;
[0119] When the request result is received, the state of the signal event is changed to a signaled state, so that the preset ...
PUM
Login to View More Abstract
Description
Claims
Application Information
Login to View More 


