Method for realizing timer

The invention relates to a timer technique, provides a method for realizing a timer, and solves the problem that a software module is inconvenient to wholly transplant in the conventional software timer. The timer adopts the following technical scheme that: firstly, a main thread creates a timer arr...

Full description

Saved in:
Bibliographic Details
Main Author YOU JINGANG
Format Patent
LanguageChinese
English
Published 09.06.2010
Subjects
Online AccessGet full text

Cover

Loading…
More Information
Summary:The invention relates to a timer technique, provides a method for realizing a timer, and solves the problem that a software module is inconvenient to wholly transplant in the conventional software timer. The timer adopts the following technical scheme that: firstly, a main thread creates a timer array and initializes the timer array to generate a head node for managing the array; secondly, a user thread creates a software timer and initializes the timer parameters; thirdly, the main thread creates a secondary thread, initializes a software clock through a hardware clock, finishes the registration of the timer in the array, and performs locking operation on an array operation shared lock; and fourthly, the secondary thread orderly inspects all user-defined timer nodes in the array, and judges whether a value of a counter thereof is 0 or not one by one, if so, executes overtime timer event, otherwise, performs reducing 1 operation on the counter and then returns to the step of orderly inspection by the secondar
Bibliography:Application Number: CN20091311448