CN107436817B - A kind of method and device carrying out remote procedure call in a synchronous manner - Google Patents
A kind of method and device carrying out remote procedure call in a synchronous manner Download PDFInfo
- Publication number
- CN107436817B CN107436817B CN201710527142.7A CN201710527142A CN107436817B CN 107436817 B CN107436817 B CN 107436817B CN 201710527142 A CN201710527142 A CN 201710527142A CN 107436817 B CN107436817 B CN 107436817B
- Authority
- CN
- China
- Prior art keywords
- remote process
- signal
- remote
- signal event
- called terminal
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/547—Remote procedure calls [RPC]; Web services
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/54—Indexing scheme relating to G06F9/54
- G06F2209/549—Remote execution
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Telephonic Communication Services (AREA)
- Communication Control (AREA)
- Telephone Function (AREA)
Abstract
The invention discloses a kind of methods for carrying out remote procedure call in a synchronous manner, comprising: when calling remote process, creates signal event corresponding with the remote process, the original state of the signal event is no signal condition;Call request needed for the remote process being called is sent to the called terminal of the remote process;The request results called a preset function by the corresponding thread suspension of the remote process, and the called terminal is waited to return;It is to have signal condition for the Status Change of the signal event, so that the preset function is by the corresponding thread wakening of the remote process when receiving the request results.The present invention is realized when carrying out remote procedure call, can reduce system resource waste, guarantees the technical effect of program feature.Meanwhile the invention also discloses a kind of devices for carrying out remote procedure call in a synchronous manner.
Description
Technical field
The present invention relates to network direct broadcasting technical fields, more particularly to a kind of side for carrying out remote procedure call in a synchronous manner
Method and device.
Background technique
With the progress of network communication technology and the speed-raising of broadband network, network direct broadcasting obtained it is more and more development and
Using.During network direct broadcasting, remote procedure call often will do it.
So-called remote procedure call, exactly a process calls method provided by another process, but is calling
The angle of person is still with calling the function of this process to be consistent.In remote procedure call, will be supplied to callee into
All argument sequences of journey turn to an internet message, are then sent in callee process by network transmission.It is called
After person handles the corresponding service of completion, the result of generation also sequence is melted into an internet message, is sent to caller process.And
In this process, when caller call a remote process to receiving result before, usually all be block;Namely receiving
To before the response result of callee, after caller calls a remote process, blocks always, answered until receiving
Answering result can just be waken up.
In current remote procedure call mechanisms, usually after calling remote process, the Sleep of meeting recursive call system is slept
Dormancy method can just return after receiving response result message, or wait time-out.But this way is thicker
It is rough, because, there is no the right of execution of current thread is deprived, currently calling the line of remote process when calling system Sleep function
Journey still can consume the cpu resource of system, cause the waste of resource, if initiating multiple remote process tune in the process simultaneously
With then system CPU resource will cause huge waste, while also drastically reducing program feature.
Summary of the invention
The embodiment of the present application is solved by providing a kind of method and device for carrying out remote procedure call in a synchronous manner
In the prior art when carrying out remote procedure call, there are system resource waste, the technical issues of reducing program feature, realize
When carrying out remote procedure call, system resource waste can reduce, guarantee the technical effect of program feature.
In a first aspect, the application is provided the following technical solutions by the embodiment of the application:
A method of carrying out remote procedure call in a synchronous manner, comprising:
When calling remote process, create corresponding with remote process signal event, the signal event it is initial
State is no signal condition;
Call request needed for the remote process being called is sent to the called terminal of the remote process;
It calls a preset function by the corresponding thread suspension of the remote process, and waits asking for the called terminal return
Seek result;
When receiving the request results, the Status Change of the signal event there is into signal condition, so that
The preset function is by the corresponding thread wakening of the remote process.
Preferably, creation signal event corresponding with the remote process, comprising:
Call CreateEvent function creation signal event corresponding with the remote process;
Unique identifier is distributed to the signal event, and by the signal event and the unique identifier storage in word
In allusion quotation Dict, the unique identifier is corresponding with the signal event.
Preferably, it is described will call the remote process needed for call request be sent to the called of the remote process
End, comprising:
It establishes and is connected to the network with the called terminal;
The unique identifier is issued into the called terminal together with the call request.
Preferably, one preset function of the calling is by the corresponding thread suspension of the remote process, and waits described adjusted
The results messages returned with end, comprising:
It calls WaitForSingleObject function by the corresponding thread suspension of the remote process, and waits the quilt
The results messages for calling end to return.
Preferably, described when receiving the request results, it is to have signal shape by the Status Change of the signal event
State, comprising:
When receiving the request results, the unique identifier is extracted from the request results;
Based on the unique identifier, the signal event is searched in the dictionary Dict;
The Status Change of the signal event is to have signal condition by calling SetEvent function.
Preferably, the result that is described by the corresponding thread suspension of the remote process, and waiting the called terminal to return
After message, further includes:
Whether the network connection between detection and the called terminal disconnects;
It is to have signal condition for the Status Change of the signal event, thus will by the preset function if disconnecting
The corresponding thread wakening of the remote process.
Preferably, whether the network connection between the detection and the called terminal disconnects, comprising:
Detect whether the corresponding thread of the network connection enters in OnError call back function;
If so, showing that the network connection disconnects.
Second aspect, the application pass through the embodiment of the application, provide the following technical solutions:
A kind of device carrying out remote procedure call in a synchronous manner, comprising:
Creating unit, for creating signal event corresponding with the remote process, the letter when calling remote process
The original state of number event is no signal condition;
Transmission unit is sent to being adjusted for the remote process for call request needed for calling the remote process
With end;
Call unit for calling a preset function by the corresponding thread suspension of the remote process, and waits the quilt
The request results for calling end to return;
Changing unit, for being to have signal by the Status Change of the signal event when receiving the request results
State, so that the preset function is by the corresponding thread wakening of the remote process.
The third aspect, the application pass through the embodiment of the application, provide the following technical solutions:
A kind of device carrying out remote procedure call in a synchronous manner, including memory, processor and it is stored in memory
Computer program that is upper and can running on a processor, which is characterized in that the processor is realized following when executing described program
Step:
When calling remote process, create corresponding with remote process signal event, the signal event it is initial
State is no signal condition;
Call request needed for the remote process being called is sent to the called terminal of the remote process;
It calls a preset function by the corresponding thread suspension of the remote process, and waits asking for the called terminal return
Seek result;
When receiving the request results, the Status Change of the signal event there is into signal condition, so that
The preset function is by the corresponding thread wakening of the remote process.
Fourth aspect, the application pass through the embodiment of the application, provide the following technical solutions:
A kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the program is by processor
It is performed the steps of when execution
When calling remote process, create corresponding with remote process signal event, the signal event it is initial
State is no signal condition;
Call request needed for the remote process being called is sent to the called terminal of the remote process;
It calls a preset function by the corresponding thread suspension of the remote process, and waits asking for the called terminal return
Seek result;
When receiving the request results, the Status Change of the signal event there is into signal condition, so that
The preset function is by the corresponding thread wakening of the remote process.
One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages:
In the embodiment of the present application, a kind of method for carrying out remote procedure call in a synchronous manner is disclosed, comprising: adjusting
When with remote process, signal event corresponding with the remote process is created, the original state of the signal event is no signal
State;Call request needed for the remote process being called is sent to the called terminal of the remote process;One is called to preset
Function is by the corresponding thread suspension of the remote process, and the request results for waiting the called terminal to return;Receiving
It is to have signal condition for the Status Change of the signal event, so that the preset function will be described when stating request results
The corresponding thread wakening of remote process.Due to when calling remote process, by the corresponding thread suspension of remote process, so solving
In the prior art when carrying out remote procedure call, there are system resource waste, the technical issues of reducing program feature, realize
When carrying out remote procedure call, it can reduce system resource waste, guarantee the technical effect of program feature.
Detailed description of the invention
To describe the technical solutions in the embodiments of the present invention more clearly, make required in being described below to embodiment
Attached drawing is briefly described, it should be apparent that, drawings in the following description are some embodiments of the invention, for this
For the those of ordinary skill of field, without creative efforts, it can also be obtained according to these attached drawings others
Attached drawing.
Fig. 1 is a kind of flow chart for the method for carrying out remote procedure call in a synchronous manner in the embodiment of the present application;
Fig. 2 is a kind of structure chart for the device 200 for carrying out remote procedure call in a synchronous manner in the embodiment of the present application;
Fig. 3 is a kind of structure chart for the device 300 for carrying out remote procedure call in a synchronous manner in the embodiment of the present application;
Fig. 4 is a kind of schematic diagram of computer readable storage medium in the embodiment of the present application.
Specific embodiment
The embodiment of the present application is solved by providing a kind of method and device for carrying out remote procedure call in a synchronous manner
In the prior art when carrying out remote procedure call, there are system resource waste, the technical issues of reducing program feature, realize
When carrying out remote procedure call, system resource waste can reduce, guarantee the technical effect of program feature.
The technical solution of the embodiment of the present application is in order to solve the above technical problems, general thought is as follows:
A method of in a synchronous manner carry out remote procedure call, comprising: when calling remote process, create with it is described
The corresponding signal event of remote process, the original state of the signal event are no signal condition;The remote process will be called
Required call request is sent to the called terminal of the remote process;Call a preset function that the remote process is corresponding
Thread suspension, and the request results for waiting the called terminal to return;When receiving the request results, by the signal thing
The Status Change of part is to have signal condition, so that the preset function is by the corresponding thread wakening of the remote process.
In order to better understand the above technical scheme, in conjunction with appended figures and specific embodiments to upper
Technical solution is stated to be described in detail.
Embodiment one
As shown in Figure 1, present embodiments providing a kind of method for carrying out remote procedure call in a synchronous manner, comprising:
Step S101: when calling remote process, signal event corresponding with the remote process, the signal thing are created
The original state of part is no signal condition.
As an alternative embodiment, step S101, comprising:
Call CreateEvent function creation signal event corresponding with the remote process;To the signal event point
With unique identifier, and by the signal event and the unique identifier storage in dictionary Dict, the unique identifier
It is corresponding with the signal event.
In the specific implementation process, it calls end that can call one or more remote process simultaneously, can specifically pass through tune
The calling of remote process is carried out with RpcCallProcedure function.When calling a remote process, can call
CreateEvent function creation signal event (Event) corresponding with the remote process, and it is unique to signal event distribution one
Identifier gid.Wherein, the calling end refers specifically to call end process.
In the specific implementation process, when calling multiple remote process, then right for each remote process creation one
The signal event answered, and a unique identifier is distributed for each signal event, remote process and signal event, which exist, to be corresponded to
There are corresponding relationships for relationship, signal event and unique identifier, then will be each corresponding to signal event and each signal event
Unique identifier storage in dictionary Dict, searched after convenient.
For example, when calling remote process 01, then signal event 01 corresponding with remote process 01 is created, and to letter
Number event 01 distributes unique identifier gid01, then signal event 01 and unique identifier gid01 are stored in dictionary Dict;
When calling remote process 02, then signal event 02 corresponding with remote process 02 is created, and distribute uniquely signal event 02
Identifier gid02, then signal event 02 and unique identifier gid02 are stored in dictionary Dict;Calling remote process 03
When, then signal event 03 corresponding with remote process 03 is created, and distribute unique identifier gid03 to signal event 03, then will
Signal event 03 and unique identifier gid03 are stored in dictionary Dict;And so on.
Step S102: call request needed for calling the remote process is sent to the called of the remote process
End.
As an alternative embodiment, step S102, comprising:
It establishes and is connected to the network with called terminal;Unique identifier is issued into called terminal together with the call request.
For example, when calling remote process 01, then together by corresponding call request 01 and unique identifier gid01
Issue called terminal;When calling remote process 02, then corresponding call request 02 and unique identifier gid02 are issued together
Called terminal;When calling remote process 03, then corresponding call request 03 and unique identifier gid03 is issued together and adjusted
With end;And so on.Wherein, the called terminal refers specifically to called terminal process.
It in the specific implementation process, can be by calling RpcCallProcedure function, by unique identifier together with tune
Called terminal is issued together with request.Alternatively, unique identifier can also be carried in call request.
Step S103: it calls a preset function by the corresponding thread suspension of the remote process, and called terminal is waited to return
The request results returned.
Wherein, the default preset function is WaitForSingleObject function.
As an alternative embodiment, step S103, comprising:
It calls WaitForSingleObject function by the corresponding thread suspension of the remote process, and waits the quilt
The results messages for calling end to return.
In the specific implementation process, WaitForSingleObject function waiting signal event can become having signal always
State, if the signal event becomes having signal condition, it is corresponding that WaitForSingleObject function can wake up the signal event
Remote process thread.
In the specific implementation process, after the corresponding thread of remote process is suspended, the thread is out of service, and is shelled
Take CPU right of execution by force, in such manner, it is possible to reduce the waste of system CPU resource, guarantees program feature, it is especially multiple long-range in progress
When the calling of process, effect is more significant.
Step S104: when receiving request results, having signal condition for the Status Change of the signal event, thus
So that preset function is by the corresponding thread wakening of the remote process.
As an alternative embodiment, step S104, comprising:
When receiving the request results, unique identifier is extracted from the request results;Based on unique mark
Know symbol, corresponding signal event is searched in dictionary Dict;Call SetEvent function by the Status Change of the signal event
To there is signal condition.
In the specific implementation process, called terminal can carry in call request only when replying calling end request results
One identifier gid calls end that can search corresponding signal event in dictionary Dict, then adjust according to unique identifier gid
The Status Change of the signal event there is into signal condition with SetEvent function.
For example, it if carrying unique identifier gid01 in request results, can be searched in dictionary Dict corresponding
Signal event 01, at this point it is possible to call SetEvent function by the Status Change of signal event 01 to there is signal condition, at this moment,
WaitForSingleObject function then can be by the corresponding thread wakening of remote process 01.
For example, it if carrying unique identifier gid02 in request results, can be searched in dictionary Dict corresponding
Signal event 02, at this point it is possible to call SetEvent function by the Status Change of signal event 02 to there is signal condition, at this moment,
WaitForSingleObject function then can be by the corresponding thread wakening of remote process 02.
In the specific implementation process, after the Status Change of a certain signal event is to have signal condition,
WaifForSingleObject function returns immediately, so that the thread of RpcCallProcedure is called to be returned.
In addition, in the prior art, when carrying out remote procedure call, other than there is system resource waste,
There is also a bigger problems, that is, after called terminal process is collapsed or is closed for some reason, then
End process is called always not receive the request results of the return from called terminal process, it is long-range that this will will lead to calling
If the thread of process in the case where being not timed-out, executes always the Sleep method of system, causes endless loop.
In order to further solve the problems, such as this, as an alternative embodiment, after step S103, further includes:
Whether the network connection between detection and the called terminal disconnects;If disconnecting, by the shape of the signal event
State has been changed to signal condition, thus by the preset function by the corresponding thread wakening of the remote process.
In the specific implementation process, it can detecte whether the corresponding thread of the network connection enters OnError readjustment letter
In number;If so, showing that the network connection disconnects.
In the specific implementation process, however, it is determined that the network connection disconnects, then can be to all signals in dictionary Dict
Event executes SetEvent function, and all signal events in dictionary have been all set to signal condition, so that calling
The thread of RpcCallProcedure returns, and avoids to cause calling end to fall into because of the problem of connection disconnects and extremely follow in this way
Ring, the problem of can not returning.
Technical solution in above-mentioned the embodiment of the present application, at least have the following technical effects or advantages:
In the embodiment of the present application, a kind of method for carrying out remote procedure call in a synchronous manner is disclosed, comprising: adjusting
When with remote process, signal event corresponding with the remote process is created, the original state of the signal event is no signal
State;Call request needed for the remote process being called is sent to the called terminal of the remote process;One is called to preset
Function is by the corresponding thread suspension of the remote process, and the request results for waiting the called terminal to return;Receiving
It is to have signal condition for the Status Change of the signal event, so that the preset function will be described when stating request results
The corresponding thread wakening of remote process.Due to when calling remote process, by the corresponding thread suspension of remote process, so solving
In the prior art when carrying out remote procedure call, there are system resource waste, the technical issues of reducing program feature, realize
When carrying out remote procedure call, it can reduce system resource waste, guarantee the technical effect of program feature.
Embodiment two
Based on the same inventive concept, a kind of device for carrying out remote procedure call in a synchronous manner is present embodiments provided
200, as shown in Figure 2, comprising:
Creating unit 201, for creating signal event corresponding with the remote process, institute when calling remote process
The original state for stating signal event is no signal condition;
Transmission unit 202 is sent to the remote process for call request needed for calling the remote process
Called terminal;
Call unit 203, for calling a preset function by the corresponding thread suspension of the remote process, and described in waiting
The request results that called terminal returns;
Changing unit 204, for being to have letter by the Status Change of the signal event when receiving the request results
Number state, so that the preset function is by the corresponding thread wakening of the remote process.
As an alternative embodiment, creating unit 201, is specifically used for:
Call CreateEvent function creation signal event corresponding with the remote process;To the signal event point
With unique identifier, and by the signal event and the unique identifier storage in dictionary Dict, the unique identifier
It is corresponding with the signal event.
As an alternative embodiment, transmission unit 202, is specifically used for:
It establishes and is connected to the network with the called terminal;The unique identifier is issued into institute together with the call request
State called terminal.
As an alternative embodiment, call unit 203, is specifically used for:
It calls WaitForSingleObject function by the corresponding thread suspension of the remote process, and waits the quilt
The results messages for calling end to return.
As an alternative embodiment, changing unit 204, is specifically used for:
When receiving the request results, the unique identifier is extracted from the request results;Based on it is described only
One identifier searches the signal event in the dictionary Dict;Call SetEvent function by the shape of the signal event
State has been changed to signal condition.
As an alternative embodiment, the device 200 for carrying out remote procedure call in a synchronous manner, is also wrapped
It includes:
Detection unit is used for the corresponding thread suspension of the remote process described, and the called terminal is waited to return
After the results messages returned, whether the network connection between detection and the called terminal is disconnected;
If disconnecting, the Status Change of the signal event there is into signal condition by changing unit 204, to pass through
The preset function is by the corresponding thread wakening of the remote process.
As an alternative embodiment, detection unit, is specifically used for:
Detect whether the corresponding thread of the network connection enters in OnError call back function;If so, showing the net
Network connection disconnects.
Since what the present embodiment was introduced carries out the device of remote procedure call in a synchronous manner as implementation the application implementation
Device used by the method for remote procedure call is carried out in a synchronous manner in example, so based on described in the embodiment of the present application
In a synchronous manner carry out remote procedure call method, those skilled in the art can understand the present embodiment with synchronization
Mode carries out the specific embodiment and its various change form of the device of remote procedure call, so herein for this with same
How the device that step mode carries out remote procedure call realizes that the method in the embodiment of the present application is no longer discussed in detail.As long as ability
Domain those of skill in the art implement device used by carrying out the method for remote procedure call in the embodiment of the present application in a synchronous manner,
Belong to the range to be protected of the application.
Technical solution in above-mentioned the embodiment of the present application, at least have the following technical effects or advantages:
In the embodiment of the present application, a kind of device for carrying out remote procedure call in a synchronous manner is disclosed, comprising: creation
Unit, for when calling remote process, creation signal event corresponding with the remote process, the signal event it is initial
State is no signal condition;Transmission unit is sent to described long-range for call request needed for calling the remote process
The called terminal of process;Call unit for calling a preset function by the corresponding thread suspension of the remote process, and waits
The request results that the called terminal returns;Changing unit, for when receiving the request results, by the signal event
Status Change be to have signal condition so that the preset function is by the corresponding thread wakening of the remote process.Due to
When calling remote process, by the corresponding thread suspension of remote process, remote process is being carried out in the prior art so solving
When calling, there are system resource waste, the technical issues of reducing program feature, realize when carrying out remote procedure call, energy
System resource waste is enough reduced, guarantees the technical effect of program feature.
Embodiment three
Based on the same inventive concept, as shown in figure 3, present embodiments providing a kind of progress remote process tune in a synchronous manner
Device 300 including memory 310, processor 320 and is stored on memory 310 and can run on the processor 320
Computer program 311, processor 320 perform the steps of when executing the computer program 311
When calling remote process, create corresponding with remote process signal event, the signal event it is initial
State is no signal condition;
Call request needed for the remote process being called is sent to the called terminal of the remote process;
It calls a preset function by the corresponding thread suspension of the remote process, and waits asking for the called terminal return
Seek result;
When receiving the request results, the Status Change of the signal event there is into signal condition, so that
The preset function is by the corresponding thread wakening of the remote process.
In the specific implementation process, when processor 320 executes computer program 311, a kind of times of embodiment may be implemented
One embodiment.
Example IV
Based on the same inventive concept, as shown in figure 4, present embodiments providing a kind of computer readable storage medium 400,
On be stored with computer program 411, which performs the steps of when being executed by processor
When calling remote process, create corresponding with remote process signal event, the signal event it is initial
State is no signal condition;
Call request needed for the remote process being called is sent to the called terminal of the remote process;
It calls a preset function by the corresponding thread suspension of the remote process, and waits asking for the called terminal return
Seek result;
When receiving the request results, the Status Change of the signal event there is into signal condition, so that
The preset function is by the corresponding thread wakening of the remote process.
In the specific implementation process, when which is executed by processor, a kind of times of embodiment may be implemented
One embodiment.
It should be understood by those skilled in the art that, the embodiment of the present invention can provide as method, system or computer program
Product.Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the present invention
Apply the form of example.Moreover, it wherein includes the computer of computer usable program code that the present invention, which can be used in one or more,
The computer program implemented in usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) produces
The form of product.
The present invention be referring to according to the method for the embodiment of the present invention, the process of equipment (system) and computer program product
Figure and/or block diagram describe.It should be understood that every one stream in flowchart and/or the block diagram can be realized by computer program instructions
The combination of process and/or box in journey and/or box and flowchart and/or the block diagram.It can provide these computer programs
Instruct the processor of general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produce
A raw machine, so that being generated by the instruction that computer or the processor of other programmable data processing devices execute for real
The device for the function of being specified in present one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy
Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates,
Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or
The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting
Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or
The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one
The step of function of being specified in a box or multiple boxes.
Although preferred embodiments of the present invention have been described, it is created once a person skilled in the art knows basic
Property concept, then additional changes and modifications may be made to these embodiments.So it includes excellent that the following claims are intended to be interpreted as
It selects embodiment and falls into all change and modification of the scope of the invention.
Obviously, various changes and modifications can be made to the invention without departing from essence of the invention by those skilled in the art
Mind and range.In this way, if these modifications and changes of the present invention belongs to the range of the claims in the present invention and its equivalent technologies
Within, then the present invention is also intended to include these modifications and variations.
Claims (8)
1. a kind of method for carrying out remote procedure call in a synchronous manner characterized by comprising
When calling remote process, signal event corresponding with the remote process, the original state of the signal event are created
For no signal condition;
Call request needed for the remote process being called is sent to the called terminal of the remote process;
It calls WaitForSingleObject function by the corresponding thread suspension of the remote process, and waits described called
Hold the request results returned;
It is to have signal condition by the Status Change of the signal event, so that described when receiving the request results
WaitForSingleObject function is by the corresponding thread wakening of the remote process;
It is described by the corresponding thread suspension of the remote process, and after the results messages for waiting the called terminal to return, also
Include:
Whether the network connection between detection and the called terminal disconnects;
It is to have signal condition for the Status Change of the signal event, thus by described if disconnecting
WaitForSingleObject function is by the corresponding thread wakening of the remote process.
2. as described in claim 1 in a synchronous manner carry out remote procedure call method, which is characterized in that it is described creation with
The corresponding signal event of the remote process, comprising:
Call CreateEvent function creation signal event corresponding with the remote process;
Unique identifier is distributed to the signal event, and by the signal event and the unique identifier storage in dictionary
In Dict, the unique identifier is corresponding with the signal event.
3. carrying out the method for remote procedure call in a synchronous manner as claimed in claim 2, which is characterized in that described to call
Call request needed for the remote process is sent to the called terminal of the remote process, comprising:
It establishes and is connected to the network with the called terminal;
The unique identifier is issued into the called terminal together with the call request.
4. carrying out the method for remote procedure call in a synchronous manner as claimed in claim 2, which is characterized in that described to receive
It is to have signal condition by the Status Change of the signal event when to the request results, comprising:
When receiving the request results, the unique identifier is extracted from the request results;
Based on the unique identifier, the signal event is searched in the dictionary Dict;
The Status Change of the signal event is to have signal condition by calling SetEvent function.
5. the method for carrying out remote procedure call in a synchronous manner as described in Claims 1 to 4 is any, which is characterized in that institute
Whether the network connection stated between detection and the called terminal disconnects, comprising:
Detect whether the corresponding thread of the network connection enters in OnError call back function;
If so, showing that the network connection disconnects.
6. a kind of device for carrying out remote procedure call in a synchronous manner characterized by comprising
Creating unit, for creating signal event corresponding with the remote process, the signal thing when calling remote process
The original state of part is no signal condition;
Transmission unit is sent to the called of the remote process for call request needed for calling the remote process
End;
Call unit for calling WaitForSingleObject function by the corresponding thread suspension of the remote process, and waits
The request results returned to the called terminal;
Changing unit, for being to have signal condition by the Status Change of the signal event when receiving the request results,
So that the WaitForSingleObject function is by the corresponding thread wakening of the remote process;
It is described by the corresponding thread suspension of the remote process, and after the results messages for waiting the called terminal to return, also
Include:
Whether the network connection between detection and the called terminal disconnects;
It is to have signal condition for the Status Change of the signal event, thus by described if disconnecting
WaitForSingleObject function is by the corresponding thread wakening of the remote process.
7. a kind of device for carrying out remote procedure call in a synchronous manner, including memory, processor and storage are on a memory
And the computer program that can be run on a processor, which is characterized in that the processor realizes following step when executing described program
It is rapid:
When calling remote process, signal event corresponding with the remote process, the original state of the signal event are created
For no signal condition;
Call request needed for the remote process being called is sent to the called terminal of the remote process;
It calls WaitForSingleObject function by the corresponding thread suspension of the remote process, and waits described called
Hold the request results returned;
It is to have signal condition by the Status Change of the signal event, so that described when receiving the request results
WaitForSingleObject function is by the corresponding thread wakening of the remote process;
It is described by the corresponding thread suspension of the remote process, and after the results messages for waiting the called terminal to return, also
Include:
Whether the network connection between detection and the called terminal disconnects;
It is to have signal condition for the Status Change of the signal event, thus by described if disconnecting
WaitForSingleObject function is by the corresponding thread wakening of the remote process.
8. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the program is held by processor
It is performed the steps of when row
When calling remote process, signal event corresponding with the remote process, the original state of the signal event are created
For no signal condition;
Call request needed for the remote process being called is sent to the called terminal of the remote process;
It calls WaitForSingleObject function by the corresponding thread suspension of the remote process, and waits described called
Hold the request results returned;
It is to have signal condition by the Status Change of the signal event, so that described when receiving the request results
WaitForSingleObject function is by the corresponding thread wakening of the remote process;
It is described by the corresponding thread suspension of the remote process, and after the results messages for waiting the called terminal to return, also
Include:
Whether the network connection between detection and the called terminal disconnects;
It is to have signal condition for the Status Change of the signal event, thus by described if disconnecting
WaitForSingleObject function is by the corresponding thread wakening of the remote process.
Priority Applications (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710527142.7A CN107436817B (en) | 2017-06-30 | 2017-06-30 | A kind of method and device carrying out remote procedure call in a synchronous manner |
| PCT/CN2017/111001 WO2019000790A1 (en) | 2017-06-30 | 2017-11-15 | Method and device for calling remote procedure using synchronous mode |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710527142.7A CN107436817B (en) | 2017-06-30 | 2017-06-30 | A kind of method and device carrying out remote procedure call in a synchronous manner |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN107436817A CN107436817A (en) | 2017-12-05 |
| CN107436817B true CN107436817B (en) | 2019-01-29 |
Family
ID=60459605
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201710527142.7A Active CN107436817B (en) | 2017-06-30 | 2017-06-30 | A kind of method and device carrying out remote procedure call in a synchronous manner |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN107436817B (en) |
| WO (1) | WO2019000790A1 (en) |
Families Citing this family (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108563523B (en) * | 2018-04-25 | 2021-06-04 | 咪咕文化科技有限公司 | Information callback method, equipment and storage medium |
| EP3929631B1 (en) | 2020-06-22 | 2023-04-05 | TotalEnergies OneTech | Method and system for analyzing a reservoir grid of a reservoir geological formation based on 4d seismic images |
| CN113190624B (en) * | 2021-05-21 | 2025-05-09 | 中国工商银行股份有限公司 | Asynchronous-to-synchronous calling method and device based on distributed cross-container |
| CN113360302B (en) * | 2021-08-10 | 2021-10-29 | 成都市奇点软件有限公司 | Method and system for time-consuming operation cancellation and blocking asynchronous conversion |
| CN113821355A (en) * | 2021-09-06 | 2021-12-21 | 长沙博为软件技术股份有限公司 | Js-based RPC synchronous communication method and equipment |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1635485A (en) * | 2003-12-26 | 2005-07-06 | 华为技术有限公司 | Time-out adaptive method in remote synchronous calling procedure |
| EP1882614B1 (en) * | 2006-07-26 | 2011-02-02 | Delphi Technologies, Inc. | Communication control method for a vehicle |
| CN106844017A (en) * | 2015-12-03 | 2017-06-13 | 阿里巴巴集团控股有限公司 | The method and apparatus that event is processed for Website server |
Family Cites Families (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US4825354A (en) * | 1985-11-12 | 1989-04-25 | American Telephone And Telegraph Company, At&T Bell Laboratories | Method of file access in a distributed processing computer network |
| CN103425225B (en) * | 2012-05-16 | 2015-08-19 | 腾讯科技(深圳)有限公司 | Application programmer in portable data device operating system and operation method thereof |
| CN102780613B (en) * | 2012-06-19 | 2015-12-09 | 瑞斯康达科技发展股份有限公司 | A kind of method and apparatus of distributed apparatus communication between plates |
-
2017
- 2017-06-30 CN CN201710527142.7A patent/CN107436817B/en active Active
- 2017-11-15 WO PCT/CN2017/111001 patent/WO2019000790A1/en not_active Ceased
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1635485A (en) * | 2003-12-26 | 2005-07-06 | 华为技术有限公司 | Time-out adaptive method in remote synchronous calling procedure |
| EP1882614B1 (en) * | 2006-07-26 | 2011-02-02 | Delphi Technologies, Inc. | Communication control method for a vehicle |
| CN106844017A (en) * | 2015-12-03 | 2017-06-13 | 阿里巴巴集团控股有限公司 | The method and apparatus that event is processed for Website server |
Also Published As
| Publication number | Publication date |
|---|---|
| WO2019000790A1 (en) | 2019-01-03 |
| CN107436817A (en) | 2017-12-05 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN107436817B (en) | A kind of method and device carrying out remote procedure call in a synchronous manner | |
| CN104699218B (en) | A task management method and device | |
| CN107678867A (en) | A kind of method and device for carrying out remote procedure call | |
| CN106657314A (en) | Cross-data center data synchronization system and method | |
| CN106712981A (en) | Method and device for informing node change | |
| CN103645904A (en) | Cache realization method of interface calling | |
| CN105874773B (en) | Task processing device, intelligent equipment, task processing method and baseband processor | |
| CN106131138A (en) | A kind of display data real time propelling movement system and method based on non-obstruction queue | |
| CN103885973B (en) | A kind of RPC system and implementation method based on Web engines | |
| CN102023899B (en) | Multithreaded data synchronization method and device | |
| CN118467637B (en) | Database synchronization system, method, device, electronic device and medium | |
| CN110290139B (en) | Message transmission method and device | |
| CN107402826A (en) | A kind of method and device for carrying out remote procedure call in an asynchronous manner | |
| CN110324370B (en) | Method and device for pushing data from server to client | |
| CN116028578A (en) | Block chain data synchronization method, device, electronic equipment and readable storage medium | |
| CN109587068B (en) | Traffic switching method, apparatus, device, and computer-readable storage medium | |
| CN108600349B (en) | Connection management method and device in connection pool | |
| CN107239272B (en) | Video capture equipment redirection method and device | |
| CN113315736B (en) | Data synchronization method and device between business processes | |
| CN106028150B (en) | More application switching management methods of TV for linux system | |
| CN104754424A (en) | Node list access method and node list access device | |
| CN103049253A (en) | System for mobile phone client development | |
| CN115314509A (en) | A method, device, device and storage medium for synchronizing application registration information | |
| WO2021082992A1 (en) | Instantiated request generation method, interface virtual machine configuration method, nfvo, and vim | |
| CN104539698B (en) | A kind of multithreading socket synchronous communication cut-in method based on delay amendment |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |