CN110321180A - A method of avoiding status poll in software design - Google Patents
A method of avoiding status poll in software design Download PDFInfo
- Publication number
- CN110321180A CN110321180A CN201910307597.7A CN201910307597A CN110321180A CN 110321180 A CN110321180 A CN 110321180A CN 201910307597 A CN201910307597 A CN 201910307597A CN 110321180 A CN110321180 A CN 110321180A
- Authority
- CN
- China
- Prior art keywords
- function
- module
- event
- main control
- controlled
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 19
- 230000004044 response Effects 0.000 claims description 6
- 230000000694 effects Effects 0.000 abstract description 3
- 230000007246 mechanism Effects 0.000 abstract description 3
- 238000000926 separation method Methods 0.000 description 4
- 238000005538 encapsulation Methods 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 238000011161 development Methods 0.000 description 2
- 230000000007 visual effect Effects 0.000 description 2
- 101100215340 Solanum tuberosum AC97 gene Proteins 0.000 description 1
- 238000013459 approach Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
- 230000004382 visual function Effects 0.000 description 1
- 238000012800 visualization Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR 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/44—Arrangements for executing specific programs
- G06F9/448—Execution paradigms, e.g. implementations of programming paradigms
- G06F9/4488—Object-oriented
- G06F9/449—Object-oriented method invocation or resolution
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
A method of avoiding status poll in software design, the interface function of controlled module can be quoted, be called to main control module, and the function of active module cannot be quoted, be called to controlled module;The described method comprises the following steps: 1) business event in controlled module is needed the content responded to be packaged into a function by main control module;2) function pointer is defined, it is made to be initialized as being directed toward above-mentioned function;3) function pointer is quoted in controlled module;4) when the business event of controlled module occurs, if the function pointer is directed toward non-empty, otherwise the function for calling function pointer to be directed toward just does not execute the function.The present invention can be to avoid using polling mechanism to realize event triggering in main control module, to reach saving computing resource, event triggers more real-time effect.
Description
Technical field
The invention belongs to software design arts, are related to a kind of method that status poll is avoided in software design.
Background technique
A kind of most conventional methodology is from high to low or from low to high to divide software according to level in software design
For several layers;Either the system that several modules form is divided into from die angle by software.Under such methodology, level
Between, need to make some information exchanges between module, an organic whole could be formed.In general these interactive information point
At two classes: one, controlling category information;Two, the data for needing to transmit.The control of the former inclined logic or process, the latter participate in operation partially
The transmitting of the data of (calculating).
In addition, also encouraging such a theory in software design: boundary layer and operation layer separation, i.e. GUI code and industry
Business code cannot mutually be wound, and the interface function of operation layer code wrap can be quoted, called in boundary layer, but not encouraged same
When operation layer reference, call boundary layer encapsulation interface.Although this is also the conventional thinking of design, everything all has exception,
Sometimes boundary layer and operation layer are difficult to separate, it is sometimes necessary to call boundary layer in operation layer so as to make business certain is visual
Function.For example, the callback interface in Windows system WIN32 Development Framework lower keyboard and mouse is can not to do interface and business
Separation;And realize that audio data gives operation layer processing using readjustment letter mechanism in AC97 sound card development interface WaveXXX series,
At this time if wanting the waveform of visual audio that certainly will cause to call the code of boundary layer in operation layer.These are all the situations of exception.
General when no matter transmitting controls information between level or between module, there is patrol between transmitter and recipient
Point of active-passive on volume, active layers or module are known as main control module.It such as is interface active, business between interface and business
Passively, interface is main control module.Common GUI graphical interfaces or touch screen, be all by user by mouse, keyboard or striking come
Trigger the calling operation of underlying services module.But works as business data processing and obtain some event, and triggered by the event
Certain needs the status visualization on interface, and at this time interface can not trigger this event as main control module, usually
The mode of technical adoption status poll.A thread is opened by interface and goes whether polling service module occurs the event, once
The interface visual processing for triggering the state at once occurs.General this problem be prevalent in main control module and controlled module it
Between, and trigger event is generated in controlled module.At this point, can only go to take turns by main control module since controlled module can not trigger
Ask the state-event in controlled module.And poll itself can consume certain computing resource, it is prior no matter wrap count
It is spaced duration size, always will lead to the delay of state-event change and event triggering.
Summary of the invention
In order to overcome the shortcomings of that poll leads to the delay that state-event changes and event triggers in existing software design approach,
The method that the present invention provides a kind of to avoid status poll in software design, can to avoid in main control module use poll machine
Realization event triggering processed, to reach saving computing resource, event triggers more real-time effect.
The technical solution adopted by the present invention to solve the technical problems is:
A method of avoiding status poll in software design, main control module can be quoted, call connecing for controlled module
The function of active module cannot be quoted, be called to mouth function, controlled module;It the described method comprises the following steps:
1) business event in controlled module is needed the content responded to be packaged into a function by main control module;
2) function pointer is defined, it is made to be initialized as being directed toward above-mentioned function;
3) function pointer is quoted in controlled module;
4) when the business event of controlled module occurs, if the function pointer is directed toward non-empty, function pointer is called to refer to
To function, otherwise just do not execute the function.
Further, in the main control module, event response operation is packaged, interface is provided and is called for controlled module.
In the present invention, according to module (code) separation principle, the interface letter of controlled module can be quoted, be called to main control module
Number, and the function of active module cannot be quoted, be called to controlled module, this is also active and passive origin.Have one in controlled module
A business event, the event need to trigger some response actions of main control module, since when main control module does not know the event
Occur, so must traditionally carry out the poll of the state-event to controlled module.The present invention is by the event response of main control module
Operation carries out encapsulation appropriate, provides interface and calls for controlled module, but increase professional platform independence again, so function must be used
The interface of pointer form.
Beneficial effects of the present invention are mainly manifested in: can realize event touching using polling mechanism to avoid in main control module
Hair, to reach saving computing resource, event triggers more real-time effect.
Detailed description of the invention
Fig. 1 is a kind of schematic diagram of method that status poll is avoided in software design.
Specific embodiment
The invention will be further described below in conjunction with the accompanying drawings.
Referring to Fig.1, a method of avoiding status poll in software design, main control module can quote, it is controlled to call
The function of active module cannot be quoted, be called to the interface function of module, controlled module;It the described method comprises the following steps:
1) business event in controlled module is needed the content responded to be packaged into a function by main control module;
2) function pointer is defined, it is made to be initialized as being directed toward above-mentioned function;
3) function pointer is quoted in controlled module;
4) when the business event of controlled module occurs, if the function pointer is directed toward non-empty, function pointer is called to refer to
To function, otherwise just do not execute the function.
In the present invention, according to module (code) separation principle, the interface letter of controlled module can be quoted, be called to main control module
Number, and the function of active module cannot be quoted, be called to controlled module, this is also active and passive origin.Have one in controlled module
A business event, the event need to trigger some response actions of main control module, since when main control module does not know the event
Occur, so must traditionally carry out the poll of the state-event to controlled module.Our method is by the thing of main control module
Part response operation carries out encapsulation appropriate, provides interface and calls for controlled module, but increase professional platform independence again, so must adopt
With the interface of function pointer form.
Claims (2)
1. a kind of method for avoiding status poll in software design, which is characterized in that main control module can quote, it is controlled to call
The function of active module cannot be quoted, be called to the interface function of module, controlled module;It the described method comprises the following steps:
1) business event in controlled module is needed the content responded to be packaged into a function by main control module;
2) function pointer is defined, it is made to be initialized as being directed toward above-mentioned function;
3) function pointer is quoted in controlled module;
4) when the business event of controlled module occurs, if the function pointer is directed toward non-empty, function pointer is called to be directed toward
Otherwise function does not just execute the function.
2. a kind of method for avoiding status poll in software design as described in claim 1, which is characterized in that the master control
In module, event response operation is packaged, interface is provided and is called for controlled module.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910307597.7A CN110321180A (en) | 2019-04-17 | 2019-04-17 | A method of avoiding status poll in software design |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910307597.7A CN110321180A (en) | 2019-04-17 | 2019-04-17 | A method of avoiding status poll in software design |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110321180A true CN110321180A (en) | 2019-10-11 |
Family
ID=68113375
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910307597.7A Pending CN110321180A (en) | 2019-04-17 | 2019-04-17 | A method of avoiding status poll in software design |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110321180A (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101290588A (en) * | 2008-03-07 | 2008-10-22 | 重庆邮电大学 | Micro-embedded real time task scheduling device and scheduling method |
US20090055409A1 (en) * | 2007-08-21 | 2009-02-26 | International Business Machines Corporation | Apparatus, system, and method for customized event processing using a jdbc resource adapter |
CN107678807A (en) * | 2017-10-10 | 2018-02-09 | 郑州云海信息技术有限公司 | A kind of software realizes the method and device of state machine |
CN108920333A (en) * | 2018-07-03 | 2018-11-30 | 京东方科技集团股份有限公司 | State-event monitoring method, state-event monitor |
-
2019
- 2019-04-17 CN CN201910307597.7A patent/CN110321180A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090055409A1 (en) * | 2007-08-21 | 2009-02-26 | International Business Machines Corporation | Apparatus, system, and method for customized event processing using a jdbc resource adapter |
CN101290588A (en) * | 2008-03-07 | 2008-10-22 | 重庆邮电大学 | Micro-embedded real time task scheduling device and scheduling method |
CN107678807A (en) * | 2017-10-10 | 2018-02-09 | 郑州云海信息技术有限公司 | A kind of software realizes the method and device of state machine |
CN108920333A (en) * | 2018-07-03 | 2018-11-30 | 京东方科技集团股份有限公司 | State-event monitoring method, state-event monitor |
Non-Patent Citations (2)
Title |
---|
ELI BENDERSKY: "并发服务器(三):事件驱动", 《HTTPS://LINUX.CN/ARTICLE-9117-1.HTML》 * |
华章出版社: "《 嵌入式系统设计与实践》一一2.2 从框图到架构", 《HTTPS://DEVELOPER.ALIYUN.COM/ARTICLE/175865》 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107844189A (en) | A kind of method, system, terminal and computer-readable recording medium for reducing blank screen power consumption | |
US8850090B2 (en) | USB redirection for read transactions | |
CN107528922A (en) | A kind of information push method, terminal and computer-readable recording medium | |
CN106373249A (en) | Multi-channel queuing method and system for number calling devices and bank outlets | |
CN107273130A (en) | Method, device and the terminal for accelerating interface to draw | |
CN109471626A (en) | Page logic structure, page generation method, page data processing method and device | |
CN111767124B (en) | Request response method, device, storage medium and electronic equipment | |
US20130132620A1 (en) | Usb redirection for write streams | |
CN105550051A (en) | Asynchronous processing method and device of business request | |
WO2017114180A1 (en) | Component logical threads quantity adjustment method and device | |
EP3869324A2 (en) | Voice data processing method, apparatus, storage medium and computer program product | |
CN104135536A (en) | Data interaction method of Web management system based on Json data protocols | |
CN115794313B (en) | Virtual machine debugging method, system, electronic device and storage medium | |
EP2758840B1 (en) | Networking method | |
CN110909359A (en) | Communication method based on dual-system architecture and terminal equipment | |
CN112000446A (en) | Data transmission method and robot | |
CN114742000A (en) | SoC chip verification system, verification method and device based on FPGA cluster | |
CN110321180A (en) | A method of avoiding status poll in software design | |
CN106896956B (en) | The implementation method of multi-point touch under one kind " road " system | |
CN109284074A (en) | A kind of printing driving method, multiple nucleus system and terminal device based on multiple nucleus system | |
CN113505199A (en) | Business response information processing method and device based on bank number calling terminal and service end system | |
CN103412837A (en) | Method, device and system for improving communication stability of human interface device | |
US10360701B2 (en) | Integrated visualization | |
US20240019820A1 (en) | A data processing method and device | |
CN115599571A (en) | Data processing method and device, electronic equipment and storage medium |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20191011 |
|
RJ01 | Rejection of invention patent application after publication |