Character device note-timer (timer)

Source: Internet
Author: User

 

Two timer elements:
1. Time
2. processing functions

How to use a timer?
1. Define/set a struct:
Static struct timer_list timer_task;

Init_timer (& timer_task );
Timer_task.function = gen_rtc_timer;
Timer_task.expires = maid + 100;

2. Tell the kernel about this struct: add_timer

3. Modify the timeout value:
Mod_timer

4. Remove the Timer:
Del_timer

Guess:
1. When the timer struct is told to the kernel, the kernel will put it into a linked list.
2. The system clock is interrupted every 10 ms, and jiffies ++
3. In the system clock interrupt processing function, the time value and

Jiffies
When it is equal, execute its processing function

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.