History

[PATCH] introduce setup_timer() helper

Every user of init_timer() also needs to initialize ->function and ->data fields. This patch adds a simple setup_timer() helper for that. The schedule_timeout() is patched as an example of usage.

Oleg Nesterov committed 21 years ago

Commit a8db2db1 parent 9e4e23b3 files · +15 −10Browse files

Showing the changes to kernel/timer.c (1 of 3 files). Show all

Unified · Split

kernel/timer.c+2−6
@@ -1146,12 +1146,8 @@ fastcall signed long __sched schedule_timeout(signed long timeout) · 1145 unmodified lines
1146 1146
1147 expire = timeout + jiffies;1147 expire = timeout + jiffies;
1148 1148
1149 init_timer(&timer);1149 setup_timer(&timer, process_timeout, (unsigned long)current);
1150 timer.expires = expire;1150 __mod_timer(&timer, expire);
1151 timer.data = (unsigned long) current;
1152 timer.function = process_timeout;
1153
1154 add_timer(&timer);
1155 schedule();1151 schedule();
1156 del_singleshot_timer_sync(&timer);1152 del_singleshot_timer_sync(&timer);
1157 1153

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t