Short small model - time event generator mode

demand

Most programs will have some things that need to execute the cycle, there are some things that need to be performed once after the program starts. Obviously this sort of thing and time-related because they both need to occur at a specific time. Such logic may be triggered by the need to perform time event generator.

Time event generator

Time event generator is mounted in the virtual root VirtualRoot a component on, which is responsible for a specific time to publish certain types of events up to the system bus. Time Event Generator will release events are:

Code location

HasBoot1SecondEvent
HasBoot2SecondEvent
HasBoot5SecondEvent
HasBoot10SecondEvent
HasBoot20SecondEvent
HasBoot1MinuteEvent
HasBoot2MinuteEvent
HasBoot5MinuteEvent
HasBoot10MinuteEvent
HasBoot20MinuteEvent
HasBoot50MinuteEvent
HasBoot100MinuteEvent
HasBoot24HourEvent

Per1SecondEvent
Per2SecondEvent
Per5SecondEvent
Per10SecondEvent
Per20SecondEvent
Per1MinuteEvent
Per2MinuteEvent
Per5MinuteEvent
Per10MinuteEvent
Per20MinuteEvent
Per50MinuteEvent
Per100MinuteEvent
Per24HourEvent

More than 26 kinds of design inspiration comes from the time of the event renminbi designed specifically why we do not get to the bottom of these values, these values ​​proved what open source miners need.

Who issues these time event?

As can be seen, this type of event does not belong to any time module, which is issued by the cpu hardware system, so for our system, it should be time event generator on the virtual root of our system VirtualRoot on.

These messages are sent to where to go?

Published to the system bus up. Each system should have its own internal system bus, an event message is the time to publish their own internal system bus up. Each of the components inside the system construction of the traveling path of event messages from the bus event subscription according to their needs.

Force: take the piece of thread drive such incidents?

If your system is a single-threaded system does not have this problem, if it is multi-threaded system, especially with the interface of the system, then it would be a problem. According to their own circumstances, such events can also be driven by the main thread UI driven by the non-UI thread, it is worth noting that if the event generator is driven by a non-UI thread, then subscribe to these news programs require careful everywhere whether some of their logic need to be performed on the UI, if the generator is driven by the UI thread then subscribe to these events the program should always be careful if your logic would be consuming more than 50 milliseconds.

Guess you like

Origin www.cnblogs.com/ntminer/p/11031506.html